This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/67661] Wrong warning when declare VLAs: operation on 'x' may be undefined [-Wsequence-point]


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

--- Comment #2 from leechung <leechung at 126 dot com> ---
(In reply to joseph@codesourcery.com from comment #1)
> You'll need to give a full testcase (complete compilable file and options 
> used to compile it).  What you gave isn't a compilable testcase; it gives 
> "error: variably modified 'y' at file scope".  Put inside a function, it 
> gives "warning: unused variable 'y' [-Wunused-variable]", but does not 
> give the warning you mention.  And there's no variable 'b' in your example 
> at all.

Sorry, I am less experience.
The following is the complete code:

#include <stdio.h>

int main (void)
{
    int x = 0, y [++ x], z [++ x];
    printf ("%d, %d, %d\n", sizeof x, sizeof y, sizeof z);
    return 0;
}

and are compiled with option '-Wall'.for example:
gcc xx.c -Wall

then produce a warning 'operation on 'x' may be undefined [-Wsequence-point]'


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]