GCC Bugzilla – Bug 47638
sanity check error message is wrong in expand_one_var
Last modified: 2011-02-08 00:54:50 UTC
in cfgexpand.c expand_one_var can give an error message like:
"error: size of variable ‘var’ is too large"
which is very wrong and misleading if DECL_SIZE(var) is actually =0
I modified the line like this:
error ("size of variable %q+D is too large, size: %i", var, DECL_SIZE_UNIT(var));
error: size of variable ‘var’ is too large, size: 0
DECL_SIZE(var) = 0 can happen when the type layout is missing.
the fix is obvious, we need another error message for this case.
We should not get to where we are outputting the error message if the layout has not been done.
If you are going to change it to be anything, I think it should be an internal error rather than an user error as the user program (from any front-end) should not be able to get to the point where the decl's size is zero.
I agree, DECL_SIZE(var) == 0 should be an ICE, with sometime like "layout error" or missing layout for variable.