public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/48326] New: Target attribute leaks from function pointers
@ 2011-03-29  6:45 michael at talamasca dot ocis.net
  2011-03-29  7:04 ` [Bug target/48326] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: michael at talamasca dot ocis.net @ 2011-03-29  6:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48326

           Summary: Target attribute leaks from function pointers
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: michael@talamasca.ocis.net


Created attachment 23795
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23795
Raw preprocessed code demonstrating the bug.

In at least one case, a function -not- bearing a target attribute may be
compiled with illegal instructions for the current -m option, when it handles
pointers to functions that do have a permissive target attribute.

Attached is a demonstration case.  When compiled on i386 with "-O1
-march=i386", a "cmovne" instruction is emitted.

One thing that makes this bug especially serious, is that my testcase is
distilled down from the function init_vectorized_lexer of "libcpp/lex.c" in GCC
itself.  As a result, GCC 4.6.0 will fail to bootstrap on any processor that
does not support cmov-family instructions.


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

* [Bug target/48326] Target attribute leaks from function pointers
  2011-03-29  6:45 [Bug c/48326] New: Target attribute leaks from function pointers michael at talamasca dot ocis.net
@ 2011-03-29  7:04 ` pinskia at gcc dot gnu.org
  2011-03-29 10:26 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-03-29  7:04 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48326

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |target
           Severity|major                       |normal


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

* [Bug target/48326] Target attribute leaks from function pointers
  2011-03-29  6:45 [Bug c/48326] New: Target attribute leaks from function pointers michael at talamasca dot ocis.net
  2011-03-29  7:04 ` [Bug target/48326] " pinskia at gcc dot gnu.org
@ 2011-03-29 10:26 ` rguenth at gcc dot gnu.org
  2013-03-30  0:27 ` michael at talamasca dot ocis.net
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-03-29 10:26 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48326

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.03.29 10:23:10
     Ever Confirmed|0                           |1
      Known to fail|                            |4.4.4, 4.5.2, 4.6.0

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-29 10:23:10 UTC ---
Confirmed.


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

* [Bug target/48326] Target attribute leaks from function pointers
  2011-03-29  6:45 [Bug c/48326] New: Target attribute leaks from function pointers michael at talamasca dot ocis.net
  2011-03-29  7:04 ` [Bug target/48326] " pinskia at gcc dot gnu.org
  2011-03-29 10:26 ` rguenth at gcc dot gnu.org
@ 2013-03-30  0:27 ` michael at talamasca dot ocis.net
  2013-03-30 11:59 ` mikpe at it dot uu.se
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: michael at talamasca dot ocis.net @ 2013-03-30  0:27 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48326

--- Comment #2 from michael at talamasca dot ocis.net <michael at talamasca dot ocis.net> 2013-03-30 00:26:53 UTC ---
The bug itself seems to have been silently fixed in 4.7.2 or earlier, maybe. 
My testcase no longer causes cmov to be emitted, although this could be an
accidental side effect of other changes.

However, there is a related bug that is definitely still present.  I noticed
the first bug because GCC itself is also an example of code that triggers it. 
This means that modern versions of GCC may fail to bootstrap themselves from
older GCCs that have the original bug.

Fixing this second bug is fairly simple, changing the ifdef that controls SSE
use in libcpp/lex.c to require GCC_VERSION >= 4008 instead of 4005.  (The exact
value is not certain, but it must at least be 4007 since 4.6.0 is known to have
the bug.)

It would be a good idea to fix this in 4.7.3.  As the last version compilable
from C alone, it will be a likely intermediate stop for anyone trying to
bootstrap up from an ancient GCC installation.


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

* [Bug target/48326] Target attribute leaks from function pointers
  2011-03-29  6:45 [Bug c/48326] New: Target attribute leaks from function pointers michael at talamasca dot ocis.net
                   ` (2 preceding siblings ...)
  2013-03-30  0:27 ` michael at talamasca dot ocis.net
@ 2013-03-30 11:59 ` mikpe at it dot uu.se
  2013-03-30 12:31 ` mikpe at it dot uu.se
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mikpe at it dot uu.se @ 2013-03-30 11:59 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48326

--- Comment #3 from Mikael Pettersson <mikpe at it dot uu.se> 2013-03-30 11:59:19 UTC ---
I can reproduce the initial bug with gcc 4.4.7, 4.5.3, 4.6.3, and 4.7.0, but
not with 4.5.4, 4.6-20130322, 4.7.1, or 4.7.2.


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

* [Bug target/48326] Target attribute leaks from function pointers
  2011-03-29  6:45 [Bug c/48326] New: Target attribute leaks from function pointers michael at talamasca dot ocis.net
                   ` (3 preceding siblings ...)
  2013-03-30 11:59 ` mikpe at it dot uu.se
@ 2013-03-30 12:31 ` mikpe at it dot uu.se
  2013-11-01  2:26 ` michael at talamasca dot ocis.net
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mikpe at it dot uu.se @ 2013-03-30 12:31 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48326

--- Comment #4 from Mikael Pettersson <mikpe at it dot uu.se> 2013-03-30 12:31:38 UTC ---
The initial bug was fixed by r187169 on 4.7 branch, I'd say it's clearly a dup
of PR53228.


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

* [Bug target/48326] Target attribute leaks from function pointers
  2011-03-29  6:45 [Bug c/48326] New: Target attribute leaks from function pointers michael at talamasca dot ocis.net
                   ` (4 preceding siblings ...)
  2013-03-30 12:31 ` mikpe at it dot uu.se
@ 2013-11-01  2:26 ` michael at talamasca dot ocis.net
  2021-08-09  7:25 ` pinskia at gcc dot gnu.org
  2021-08-15  5:43 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: michael at talamasca dot ocis.net @ 2013-11-01  2:26 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48326

--- Comment #5 from michael at talamasca dot ocis.net <michael at talamasca dot ocis.net> ---
Do I have to file a separate bug report in order to fix the problem that
current GCC releases can't be expected to bootstrap up if the starting compiler
is GCC 4.7.0 (among several other problem releases) and the host hardware is
ix86 with no cmov?

If the breakage was due to 4.7.0 miscompiling standard C, I could see why you
would write it off.  It's not practical to be portable to every known standards
violation.

But this is a breakage in code that uses GCC extensions and is preprocessed out
for non-GCC compilers.  It should be preprocessed out for <= 4.7.0 as well.


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

* [Bug target/48326] Target attribute leaks from function pointers
  2011-03-29  6:45 [Bug c/48326] New: Target attribute leaks from function pointers michael at talamasca dot ocis.net
                   ` (5 preceding siblings ...)
  2013-11-01  2:26 ` michael at talamasca dot ocis.net
@ 2021-08-09  7:25 ` pinskia at gcc dot gnu.org
  2021-08-15  5:43 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-09  7:25 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.7.0
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.

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

* [Bug target/48326] Target attribute leaks from function pointers
  2011-03-29  6:45 [Bug c/48326] New: Target attribute leaks from function pointers michael at talamasca dot ocis.net
                   ` (6 preceding siblings ...)
  2021-08-09  7:25 ` pinskia at gcc dot gnu.org
@ 2021-08-15  5:43 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-15  5:43 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |DUPLICATE

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 53228.

*** This bug has been marked as a duplicate of bug 53228 ***

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

end of thread, other threads:[~2021-08-15  5:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-29  6:45 [Bug c/48326] New: Target attribute leaks from function pointers michael at talamasca dot ocis.net
2011-03-29  7:04 ` [Bug target/48326] " pinskia at gcc dot gnu.org
2011-03-29 10:26 ` rguenth at gcc dot gnu.org
2013-03-30  0:27 ` michael at talamasca dot ocis.net
2013-03-30 11:59 ` mikpe at it dot uu.se
2013-03-30 12:31 ` mikpe at it dot uu.se
2013-11-01  2:26 ` michael at talamasca dot ocis.net
2021-08-09  7:25 ` pinskia at gcc dot gnu.org
2021-08-15  5:43 ` pinskia 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).