public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/35661]  New: __attribute__((cold)) generates wrong code
@ 2008-03-21 20:15 zuxy dot meng at gmail dot com
  2008-03-21 20:18 ` [Bug target/35661] " pinskia at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: zuxy dot meng at gmail dot com @ 2008-03-21 20:15 UTC (permalink / raw)
  To: gcc-bugs

On MinGW32, GCC 4.3.0 marks the .text.unlikely section as "w"(writable) instead
of "x"(executable), which makes the assembler to pad the section with zeros
instead of NOPs. Runtime behavior is almost always incorrect and in many cases
an application will crash.


-- 
           Summary: __attribute__((cold)) generates wrong code
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zuxy dot meng at gmail dot com
 GCC build triplet: i686-pc-mingw32
  GCC host triplet: i686-pc-mingw32
GCC target triplet: i686-pc-mingw32


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


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

* [Bug target/35661] __attribute__((cold)) generates wrong code
  2008-03-21 20:15 [Bug c/35661] New: __attribute__((cold)) generates wrong code zuxy dot meng at gmail dot com
@ 2008-03-21 20:18 ` pinskia at gcc dot gnu dot org
  2008-03-21 20:19 ` zuxy dot meng at gmail dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-21 20:18 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

* [Bug target/35661] __attribute__((cold)) generates wrong code
  2008-03-21 20:15 [Bug c/35661] New: __attribute__((cold)) generates wrong code zuxy dot meng at gmail dot com
  2008-03-21 20:18 ` [Bug target/35661] " pinskia at gcc dot gnu dot org
@ 2008-03-21 20:19 ` zuxy dot meng at gmail dot com
  2008-03-21 20:21 ` zuxy dot meng at gmail dot com
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: zuxy dot meng at gmail dot com @ 2008-03-21 20:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from zuxy dot meng at gmail dot com  2008-03-21 20:18 -------
Created an attachment (id=15356)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15356&action=view)
Sample C file that gets compiled incorrectly

Compile with "gcc -march=pentium-m -mtune=generic -O3 -fomit-frame-pointer -c"
will give an object. Run "objdump -D" over the object and you'll see several
"add    %al,(%eax)" that should be NOP instead.


-- 


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


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

* [Bug target/35661] __attribute__((cold)) generates wrong code
  2008-03-21 20:15 [Bug c/35661] New: __attribute__((cold)) generates wrong code zuxy dot meng at gmail dot com
  2008-03-21 20:18 ` [Bug target/35661] " pinskia at gcc dot gnu dot org
  2008-03-21 20:19 ` zuxy dot meng at gmail dot com
@ 2008-03-21 20:21 ` zuxy dot meng at gmail dot com
  2008-03-21 20:22 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: zuxy dot meng at gmail dot com @ 2008-03-21 20:21 UTC (permalink / raw)
  To: gcc-bugs



-- 

zuxy dot meng at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major


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


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

* [Bug target/35661] __attribute__((cold)) generates wrong code
  2008-03-21 20:15 [Bug c/35661] New: __attribute__((cold)) generates wrong code zuxy dot meng at gmail dot com
                   ` (2 preceding siblings ...)
  2008-03-21 20:21 ` zuxy dot meng at gmail dot com
@ 2008-03-21 20:22 ` pinskia at gcc dot gnu dot org
  2008-03-21 20:24 ` zuxy dot meng at gmail dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-21 20:22 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal


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


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

* [Bug target/35661] __attribute__((cold)) generates wrong code
  2008-03-21 20:15 [Bug c/35661] New: __attribute__((cold)) generates wrong code zuxy dot meng at gmail dot com
                   ` (3 preceding siblings ...)
  2008-03-21 20:22 ` pinskia at gcc dot gnu dot org
@ 2008-03-21 20:24 ` zuxy dot meng at gmail dot com
  2008-04-07  2:01 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: zuxy dot meng at gmail dot com @ 2008-03-21 20:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from zuxy dot meng at gmail dot com  2008-03-21 20:23 -------
Subject: Re:  __attribute__((cold)) generates wrong code

21 Mar 2008 20:17:53 -0000, pinskia at gcc dot gnu dot org
<gcc-bugzilla@gcc.gnu.org>:
>
>
> --
>
> pinskia at gcc dot gnu dot org changed:
>
>           What    |Removed                     |Added
> ----------------------------------------------------------------------------
>           Severity|major                       |normal

Sorry. I just revert it back. I didn't know it's intentionally changed
by someone else...


-- 


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


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

* [Bug target/35661] __attribute__((cold)) generates wrong code
  2008-03-21 20:15 [Bug c/35661] New: __attribute__((cold)) generates wrong code zuxy dot meng at gmail dot com
                   ` (4 preceding siblings ...)
  2008-03-21 20:24 ` zuxy dot meng at gmail dot com
@ 2008-04-07  2:01 ` pinskia at gcc dot gnu dot org
  2008-04-07  6:01 ` zuxy dot meng at gmail dot com
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-04-07  2:01 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-04-07 02:00:23
               date|                            |


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


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

* [Bug target/35661] __attribute__((cold)) generates wrong code
  2008-03-21 20:15 [Bug c/35661] New: __attribute__((cold)) generates wrong code zuxy dot meng at gmail dot com
                   ` (5 preceding siblings ...)
  2008-04-07  2:01 ` pinskia at gcc dot gnu dot org
@ 2008-04-07  6:01 ` zuxy dot meng at gmail dot com
  2008-04-13 12:19 ` zuxy dot meng at gmail dot com
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: zuxy dot meng at gmail dot com @ 2008-04-07  6:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from zuxy dot meng at gmail dot com  2008-04-07 06:00 -------
Created an attachment (id=15437)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15437&action=view)
Proposed patch against 4.3.0, marking .text.unlikely as executable.


-- 


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


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

* [Bug target/35661] __attribute__((cold)) generates wrong code
  2008-03-21 20:15 [Bug c/35661] New: __attribute__((cold)) generates wrong code zuxy dot meng at gmail dot com
                   ` (6 preceding siblings ...)
  2008-04-07  6:01 ` zuxy dot meng at gmail dot com
@ 2008-04-13 12:19 ` zuxy dot meng at gmail dot com
  2008-04-14 23:49 ` dannysmith at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: zuxy dot meng at gmail dot com @ 2008-04-13 12:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from zuxy dot meng at gmail dot com  2008-04-13 12:18 -------
The MinGW port has no idea of the unlikely text section ever since r80564, so
it's likely that the fix should be applied to any release branch pulled after
r80564; although before 4.3.0 the bug only affects profile feedback.


-- 


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


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

* [Bug target/35661] __attribute__((cold)) generates wrong code
  2008-03-21 20:15 [Bug c/35661] New: __attribute__((cold)) generates wrong code zuxy dot meng at gmail dot com
                   ` (7 preceding siblings ...)
  2008-04-13 12:19 ` zuxy dot meng at gmail dot com
@ 2008-04-14 23:49 ` dannysmith at gcc dot gnu dot org
  2008-05-11 21:04 ` dannysmith at gcc dot gnu dot org
  2008-05-11 21:10 ` dannysmith at users dot sourceforge dot net
  10 siblings, 0 replies; 12+ messages in thread
From: dannysmith at gcc dot gnu dot org @ 2008-04-14 23:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from dannysmith at gcc dot gnu dot org  2008-04-14 23:48 -------
Subject: Bug 35661

Author: dannysmith
Date: Mon Apr 14 23:47:39 2008
New Revision: 134296

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=134296
Log:
2008-04-16  Zuxy Meng  <zuxy.meng@gmail.com>

        PR target/35661
        * config/i386/winnt.c (i386_pe_section_type_flags): Mark
        ".text.unlikely" section as executable.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/winnt.c


-- 


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


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

* [Bug target/35661] __attribute__((cold)) generates wrong code
  2008-03-21 20:15 [Bug c/35661] New: __attribute__((cold)) generates wrong code zuxy dot meng at gmail dot com
                   ` (8 preceding siblings ...)
  2008-04-14 23:49 ` dannysmith at gcc dot gnu dot org
@ 2008-05-11 21:04 ` dannysmith at gcc dot gnu dot org
  2008-05-11 21:10 ` dannysmith at users dot sourceforge dot net
  10 siblings, 0 replies; 12+ messages in thread
From: dannysmith at gcc dot gnu dot org @ 2008-05-11 21:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from dannysmith at gcc dot gnu dot org  2008-05-11 21:04 -------
Subject: Bug 35661

Author: dannysmith
Date: Sun May 11 21:03:27 2008
New Revision: 135188

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=135188
Log:
        Backport from mainline:
        2008-04-15  Zuxy Meng  <zuxy.meng@gmail.com>

        PR target/35661
        * config/i386/winnt.c (i386_pe_section_type_flags): Mark
        ".text.unlikely" section as executable.

Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/config/i386/winnt.c


-- 


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


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

* [Bug target/35661] __attribute__((cold)) generates wrong code
  2008-03-21 20:15 [Bug c/35661] New: __attribute__((cold)) generates wrong code zuxy dot meng at gmail dot com
                   ` (9 preceding siblings ...)
  2008-05-11 21:04 ` dannysmith at gcc dot gnu dot org
@ 2008-05-11 21:10 ` dannysmith at users dot sourceforge dot net
  10 siblings, 0 replies; 12+ messages in thread
From: dannysmith at users dot sourceforge dot net @ 2008-05-11 21:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from dannysmith at users dot sourceforge dot net  2008-05-11 21:09 -------
Fixed on 4_3 branch


-- 

dannysmith at users dot sourceforge dot net changed:

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


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


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

end of thread, other threads:[~2008-05-11 21:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-21 20:15 [Bug c/35661] New: __attribute__((cold)) generates wrong code zuxy dot meng at gmail dot com
2008-03-21 20:18 ` [Bug target/35661] " pinskia at gcc dot gnu dot org
2008-03-21 20:19 ` zuxy dot meng at gmail dot com
2008-03-21 20:21 ` zuxy dot meng at gmail dot com
2008-03-21 20:22 ` pinskia at gcc dot gnu dot org
2008-03-21 20:24 ` zuxy dot meng at gmail dot com
2008-04-07  2:01 ` pinskia at gcc dot gnu dot org
2008-04-07  6:01 ` zuxy dot meng at gmail dot com
2008-04-13 12:19 ` zuxy dot meng at gmail dot com
2008-04-14 23:49 ` dannysmith at gcc dot gnu dot org
2008-05-11 21:04 ` dannysmith at gcc dot gnu dot org
2008-05-11 21:10 ` dannysmith at users dot sourceforge dot net

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