Launchpad has imported 5 comments from the remote bug at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80533.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.

------------------------------------------------------------------------
On 2017-04-26T19:07:20+00:00 3-sje wrote:

Created attachment 41274
Test case

GCC should treat zero length arrays like C99 flexible arrays when they are
at the end of a structure.  I.e. recognize that accesses to that array may
go beyond the end of the structure.   GCC has been treating zero length
arrays and flexible arrays differently since at least 5.0.

This was found on aarch64 but the bug is not platform specific.  A test case
is attached, it cannot be run but if compiled for aarch64 with
-O2 -fno-strict-aliasing and either -UFLEX or -DFLEX you can see the
different code.  In the -UFLEX case it generates a load/load/store/store
sequence and in the -DFLEX case it generates load/store/load/store for
the code in the main loop.

See also:

https://gcc.gnu.org/ml/gcc/2017-04/msg00118.html
https://gcc.gnu.org/ml/gcc-patches/2017-04/msg01257.html

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-6/+bug/1685385/comments/2

------------------------------------------------------------------------
On 2017-04-27T07:55:09+00:00 Rguenth wrote:

Mine.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-6/+bug/1685385/comments/3

------------------------------------------------------------------------
On 2017-04-27T12:35:16+00:00 Rguenth wrote:

Author: rguenth
Date: Thu Apr 27 12:34:45 2017
New Revision: 247327

URL: https://gcc.gnu.org/viewcvs?rev=247327&root=gcc&view=rev
Log:
2017-04-27  Richard Biener  <[email protected]>

        PR middle-end/80533
        * emit-rtl.c (set_mem_attributes_minus_bitpos): When
        stripping ARRAY_REFs from MEM_EXPR make sure we're not
        keeping a reference to a trailing array.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/emit-rtl.c

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-6/+bug/1685385/comments/4

------------------------------------------------------------------------
On 2017-04-27T12:59:11+00:00 Rguenth wrote:

Fixed on trunk sofar.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-6/+bug/1685385/comments/5

------------------------------------------------------------------------
On 2020-02-14T09:48:33+00:00 Rguenth wrote:

Fixed on all still maintained branches.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-6/+bug/1685385/comments/8


** Changed in: gcc
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1685385

Title:
  GCC generates bad code with zero length array and -O3

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/1685385/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to