Commit 22199fd2 by Richard Guenther Committed by Richard Biener

re PR middle-end/33631 (auto structure not initialized correctly)

2008-02-04  Richard Guenther  <rguenther@suse.de>

	PR middle-end/33631
	* expr.c (count_type_elements): Give for unions instead of
	guessing.

	* gcc.c-torture/execute/pr33631.c: New testcase.

From-SVN: r132096
parent 70c7fe74
2008-02-04 Richard Guenther <rguenther@suse.de>
PR middle-end/33631
* expr.c (count_type_elements): Give for unions instead of
guessing.
2008-02-04 Richard Guenther <rguenther@suse.de>
PR middle-end/35043
* gimplify.c (gimplify_init_ctor_eval): Convert array indices
to TYPE_DOMAINs base type instead of using bitsizetype here.
......
......@@ -4975,14 +4975,7 @@ count_type_elements (const_tree type, bool allow_flexarr)
case UNION_TYPE:
case QUAL_UNION_TYPE:
{
/* Ho hum. How in the world do we guess here? Clearly it isn't
right to count the fields. Guess based on the number of words. */
HOST_WIDE_INT n = int_size_in_bytes (type);
if (n < 0)
return -1;
return n / UNITS_PER_WORD;
}
return -1;
case COMPLEX_TYPE:
return 2;
......
2008-02-04 Richard Guenther <rguenther@suse.de>
PR middle-end/33631
* gcc.c-torture/execute/pr33631.c: New testcase.
2008-02-04 Richard Guenther <rguenther@suse.de>
PR middle-end/35043
* gcc.c-torture/compile/pr35043.c: New testcase.
typedef union
{
int __lock;
} pthread_mutex_t;
extern void abort (void);
int main()
{
struct { int c; pthread_mutex_t m; } r = { .m = 0 };
if (r.c != 0)
abort ();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment