[Bug c/58235] New: Missing diagnostic on assignment to array in c89

2013-08-23 Thread olivier.gay at a3 dot epfl.ch
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.


[Bug c/58235] Missing diagnostic on assignment to array in c89

2013-08-23 Thread olivier.gay at a3 dot epfl.ch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58235

--- Comment #2 from Olivier Gay olivier.gay at a3 dot epfl.ch ---
Still, constraint of assignment (c90, 6.3.16) requires the left operand of
assignment to be a modifiable lvalue. But c object array is not a modifiable
lvalue as arrays are not modifiable lvalues (6.2.2.1).