public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/85800] A miscompilation bug with unsigned char
       [not found] <bug-85800-4@http.gcc.gnu.org/bugzilla/>
@ 2024-01-26 10:18 ` sjames at gcc dot gnu.org
  2024-01-26 10:29 ` jakub at gcc dot gnu.org
  2024-01-26 12:30 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-01-26 10:18 UTC (permalink / raw)
  To: gcc-bugs

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

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code

--- Comment #4 from Sam James <sjames at gcc dot gnu.org> ---
Adding "wrong-code" given that's the claim. If the bug is invalid, we can
always close it as such.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/85800] A miscompilation bug with unsigned char
       [not found] <bug-85800-4@http.gcc.gnu.org/bugzilla/>
  2024-01-26 10:18 ` [Bug c/85800] A miscompilation bug with unsigned char sjames at gcc dot gnu.org
@ 2024-01-26 10:29 ` jakub at gcc dot gnu.org
  2024-01-26 12:30 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-26 10:29 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
To me the testcase looks invalid.
int B[4], A[4];
...
store_10_to_p(A, &B[4]);
...
memcpy((unsigned char*)arr2, (unsigned char *)&q, sizeof(q));

Constructing &B[4] is valid, it is a pointer to one past the last element of
the array object.  But C99 6.5.6/8
"If the result points one past the last element of the array object, it
shall not be used as the operand of a unary * operator that is evaluated."
then triggers during the memcpy when the pointer is dereferenced.
Doesn't matter that the A array starts at the same address, you'd need to use A
or &A[0] etc. instead of &B[4] to make it valid.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/85800] A miscompilation bug with unsigned char
       [not found] <bug-85800-4@http.gcc.gnu.org/bugzilla/>
  2024-01-26 10:18 ` [Bug c/85800] A miscompilation bug with unsigned char sjames at gcc dot gnu.org
  2024-01-26 10:29 ` jakub at gcc dot gnu.org
@ 2024-01-26 12:30 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-26 12:30 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Yeah.  I think we have enough duplicates that show cases where conditional
equivalence propagation introduces these issues.  Here it's already present in
the source.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-26 12:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-85800-4@http.gcc.gnu.org/bugzilla/>
2024-01-26 10:18 ` [Bug c/85800] A miscompilation bug with unsigned char sjames at gcc dot gnu.org
2024-01-26 10:29 ` jakub at gcc dot gnu.org
2024-01-26 12:30 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).