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/58235] New: Missing diagnostic on assignment to array in c89


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58235

            Bug ID: 58235
           Summary: Missing diagnostic on assignment to array in c89
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: olivier.gay at a3 dot epfl.ch

struct bla
{
    int x[1];
} s = {{0}};

struct bla foo(void)
{
    return s;
}

void bar(void)
{
    int c[1];
    c = foo().x;
}

gcc in c89 mode (-std=c89 -Wall -pedantic) does not issue a diagnostic for the
assignment to a non-modifiable lvalue in bar function. -std=c99 or -std=c11 do
issue the required diagnostic.


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