[Bug sanitizer/80168] [5/6/7 Regression] ICE in make_decl_rtl, at varasm.c:1311 w/ VLA and -fsanitize=address

2017-03-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80168

--- Comment #6 from Jakub Jelinek  ---
Author: jakub
Date: Mon Mar 27 08:25:01 2017
New Revision: 246492

URL: https://gcc.gnu.org/viewcvs?rev=246492=gcc=rev
Log:
PR sanitizer/80168
* asan.c (instrument_derefs): Copy over last operand from
original COMPONENT_REF to the new COMPONENT_REF with
DECL_BIT_FIELD_REPRESENTATIVE.
* ubsan.c (instrument_object_size): Likewise.

* gcc.dg/asan/pr80168.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/asan/pr80168.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/asan.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/ubsan.c

[Bug sanitizer/80168] [5/6/7 Regression] ICE in make_decl_rtl, at varasm.c:1311 w/ VLA and -fsanitize=address

2017-03-24 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80168

Martin Sebor  changed:

   What|Removed |Added

   Keywords|accepts-invalid |

--- Comment #5 from Martin Sebor  ---
Just a small clarification: The VLA typedef in the test case is valid, but its
use to define a member of a struct is strictly not conforming.  It's accepted
by GCC as an extension and diagnosed by -Wpedantic.  I've adjusted the Keywords
accordingly.

[Bug sanitizer/80168] [5/6/7 Regression] ICE in make_decl_rtl, at varasm.c:1311 w/ VLA and -fsanitize=address

2017-03-24 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80168

Jakub Jelinek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek  ---
Created attachment 41047
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41047=edit
gcc7-pr80168.patch

Untested fix.  Various comments e.g. in get_bit_range assert that
DECL_BIT_FIELD_REPRESENTATIVE in a VLA structure is guaranteed by construction
to have the same DECL_FIELD_OFFSET, so even when during low gimple they are not
the same, we should be able to use the 3rd COMPONENT_REF arguments from the
original field and the DECL_FIELD_BIT_OFFSET difference should give the actual
start differences between the field and its representative.

[Bug sanitizer/80168] [5/6/7 Regression] ICE in make_decl_rtl, at varasm.c:1311 w/ VLA and -fsanitize=address

2017-03-24 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80168

--- Comment #3 from Jakub Jelinek  ---
(In reply to Richard Biener from comment #1)
> I'm not sure this is valid given 'a' is global.

It is valid, VLA size is just an integral expression, and a is a valid
expression.  The size is computed at the point where the VLA is declared (we
remember there the size in some temporary if we need it later).

[Bug sanitizer/80168] [5/6/7 Regression] ICE in make_decl_rtl, at varasm.c:1311 w/ VLA and -fsanitize=address

2017-03-24 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80168

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-03-24
 Ever confirmed|0   |1

--- Comment #2 from Jakub Jelinek  ---
Started with r202949.

[Bug sanitizer/80168] [5/6/7 Regression] ICE in make_decl_rtl, at varasm.c:1311 w/ VLA and -fsanitize=address

2017-03-24 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80168

Richard Biener  changed:

   What|Removed |Added

   Keywords||accepts-invalid
 CC||jsm28 at gcc dot gnu.org
   Target Milestone|--- |5.5

--- Comment #1 from Richard Biener  ---
I'm not sure this is valid given 'a' is global.