[Bug sanitizer/109308] False positive store to address 0x62600000016c with insufficient space for an object of type 'int' since r12-6030-g422f9eb7011b76c1

2023-03-27 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109308

Martin Liška  changed:

   What|Removed |Added

   See Also||https://sourceware.org/bugz
   ||illa/show_bug.cgi?id=30279
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2023-03-28

[Bug sanitizer/109308] False positive store to address 0x62600000016c with insufficient space for an object of type 'int' since r12-6030-g422f9eb7011b76c1

2023-03-27 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109308

--- Comment #1 from Andrew Pinski  ---
Doing:
--opc;

On an address which starts an array is undefined. Even for an a memory
allocated by malloc.

[Bug sanitizer/109308] False positive store to address 0x62600000016c with insufficient space for an object of type 'int' since r12-6030-g422f9eb7011b76c1

2023-03-27 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109308

Martin Liška  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

--- Comment #2 from Martin Liška  ---
Thus invalid.

[Bug sanitizer/109308] False positive store to address 0x62600000016c with insufficient space for an object of type 'int' since r12-6030-g422f9eb7011b76c1

2023-03-27 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109308

--- Comment #3 from Andrew Pinski  ---
This code is very much undefined.
THe original code did:
  opc = XNEWVEC (struct m68hc11_opcode_def, num_opcodes);
  m68hc11_opcode_defs = opc--;

Which is definitely undefined. You cannot take the address before the allocated
memory and have it be defined. The only address which is valid is where the
array starts and one element past the allocation.

[Bug sanitizer/109308] False positive store to address 0x62600000016c with insufficient space for an object of type 'int' since r12-6030-g422f9eb7011b76c1

2023-03-28 Thread amodra at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109308

Alan Modra  changed:

   What|Removed |Added

 CC||amodra at gmail dot com

--- Comment #4 from Alan Modra  ---
I agree the code is undefined, but "store to address 0x004172b0 with
insufficient space for an object of type 'long int'" is a lie.  There plainly
*is* sufficient space at that address.

It would be nice to diagnose the actual undefined behaviour.  As a compiler
developer you might have the mindset of "it's undefined code so the compiler
can do anything", but that argument strikes me as disingenuous when we are
talking about -fsanitize=undefined!

[Bug sanitizer/109308] False positive store to address 0x62600000016c with insufficient space for an object of type 'int' since r12-6030-g422f9eb7011b76c1

2023-03-28 Thread siddhesh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109308

--- Comment #5 from Siddhesh Poyarekar  ---
This kinda has happened before:

https://github.com/Perl/perl5/issues/20678

Should we keep this bug open for the message, which is obviously wrong?