https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63645

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #7 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
(In reply to M Welinder from comment #5)
> You guys are trigger happy.
> 
> > Your union simply takes more space than your GnmExprBinary struct
> 
> Of course it does!  The union requires space that is large enough
> for its largest member, so having a smaller member is going to be
> the case in 99% of unions and the standard has no objections.
> If you think otherwise, a reference to the standard would be nice.
> 
> To show that the size difference is irrelevant, simply change
> GnmExprBinary to
> 
> typedef struct {
>       guint8 oper;
>       int argc;
>       GnmFunc *func;
> } GnmExprBinary;
> 
> whereupon GnmExprBinary, GnmExprFunction, and GnmExpr all take up the
> same amount of space.

Or adjust your malloc, which is simply too small in your orginal testcase.

> We still get this error from valgrind.
> 
> ==6201== Conditional jump or move depends on uninitialised value(s)
> ==6201==    at 0x4005F8: test (vvv.c:38)
> ==6201==    by 0x4004D8: main (vvv.c:49)

That is a different issue. You access  expr->func.argc and expr->func.func  
in your if expression. And of course they are uninitialised.

Reply via email to