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

--- Comment #37 from alalaw01 at gcc dot gnu.org ---
(In reply to Jakub Jelinek from comment #36)
> As Richard said, you can do similar (invalid too) stuff in C too, say:
> struct S { int a[10000]; } s;
> in one TU and
> struct S { int a[1]; } s;
> 
> int
> foo (int x)
> {
>   return s.a[x];
> }
> 
> int
> bar (int x)
> {
>   return s.a[1 + x] + s.a[0] + s.a[x];
> }
> 
> GCC 5 would compile it to what the author might have meant, while GCC 6 will
> optimize bar into s.a[0] * 3;

Yes, this was what I meant in comment #33. The question is, do we care? (Or, do
we only care in the FORTRAN case?)

If so, then we presumably want a -fbroken-common-blocks (or something!) that is
not FE-specific.

Reply via email to