public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/66265] New: strict aliasing with O2 fails to generate correct code and gives no warnings
@ 2015-05-23 18:34 gougolith at gmail dot com
  2015-05-25  7:50 ` [Bug c/66265] " jakub at gcc dot gnu.org
  2015-05-25 15:10 ` gougolith at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: gougolith at gmail dot com @ 2015-05-23 18:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 66265
           Summary: strict aliasing with O2 fails to generate correct code
                    and gives no warnings
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gougolith at gmail dot com
  Target Milestone: ---

Created attachment 35607
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35607&action=edit
Sample code that exhibits the issue.

This may be a genuine bug since the issue manifests itself depending on the way
the memory allocation is done. Clearly the pointers are all the same type.

I turned on the following flags to generate the code:

gcc -Wall -O2 -pedantic -Wextra -Wall

Generates no warnings of any kind but the program is broken.


gcc -Wall -O2 -pedantic -Wextra -Wall -fno-strict-aliasing

Generates no warnings and correct program.

I'm sure this is a strict-aliasing issue but it makes no sense why no warning
is issued if that's the case?


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

* [Bug c/66265] strict aliasing with O2 fails to generate correct code and gives no warnings
  2015-05-23 18:34 [Bug c/66265] New: strict aliasing with O2 fails to generate correct code and gives no warnings gougolith at gmail dot com
@ 2015-05-25  7:50 ` jakub at gcc dot gnu.org
  2015-05-25 15:10 ` gougolith at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-05-25  7:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
There is a warning with -Wstrict-aliasing=1 , if you read the documentation,
you'd find there are various levels that differ in the amount of false
positives.  The code is obviously invalid.


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

* [Bug c/66265] strict aliasing with O2 fails to generate correct code and gives no warnings
  2015-05-23 18:34 [Bug c/66265] New: strict aliasing with O2 fails to generate correct code and gives no warnings gougolith at gmail dot com
  2015-05-25  7:50 ` [Bug c/66265] " jakub at gcc dot gnu.org
@ 2015-05-25 15:10 ` gougolith at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: gougolith at gmail dot com @ 2015-05-25 15:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Mark <gougolith at gmail dot com> ---
Yes thank you, it all makes sense unfortunately...it is all buried in -O2...

On Mon, May 25, 2015 at 12:50 AM, jakub at gcc dot gnu.org <
gcc-bugzilla@gcc.gnu.org> wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66265
>
> Jakub Jelinek <jakub at gcc dot gnu.org> changed:
>
>            What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>              Status|UNCONFIRMED                 |RESOLVED
>                  CC|                            |jakub at gcc dot gnu.org
>          Resolution|---                         |INVALID
>
> --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> There is a warning with -Wstrict-aliasing=1 , if you read the
> documentation,
> you'd find there are various levels that differ in the amount of false
> positives.  The code is obviously invalid.
>
> --
> You are receiving this mail because:
> You reported the bug.
>


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

end of thread, other threads:[~2015-05-25 15:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-23 18:34 [Bug c/66265] New: strict aliasing with O2 fails to generate correct code and gives no warnings gougolith at gmail dot com
2015-05-25  7:50 ` [Bug c/66265] " jakub at gcc dot gnu.org
2015-05-25 15:10 ` gougolith at gmail dot com

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).