Bug 47638 - sanity check error message is wrong in expand_one_var
sanity check error message is wrong in expand_one_var
Status: UNCONFIRMED
Product: gcc
Classification: Unclassified
Component: middle-end
4.6.0
: P3 trivial
: ---
Assigned To: Not yet assigned to anyone
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-02-08 00:15 UTC by Ádám Rák
Modified: 2011-02-08 00:54 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ádám Rák 2011-02-08 00:15:08 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));
and got:

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.
Comment 1 Andrew Pinski 2011-02-08 00:35:10 UTC
We should not get to where we are outputting the error message if the layout has not been done.
Comment 2 Andrew Pinski 2011-02-08 00:45:57 UTC
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.
Comment 3 Ádám Rák 2011-02-08 00:54:50 UTC
I agree, DECL_SIZE(var) == 0 should be an ICE, with sometime like "layout error" or missing layout for variable.