public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/18450] New: Wrong code generated by gcc from inline assembler
@ 2004-11-12 11:01 thalakan at technologist dot com
  2004-11-12 11:09 ` [Bug inline-asm/18450] " thalakan at technologist dot com
  2004-11-12 12:46 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: thalakan at technologist dot com @ 2004-11-12 11:01 UTC (permalink / raw)
  To: gcc-bugs

I wrote an x86 specific program that uses inline assembler to set and unset the
alignment check bit in the EFLAGS register.  In between setting and unsetting
the bit, I use more inline assembler to save the state of the EFLAGS register.

The problem is that I get different results depending on whether optimization is
turned on or not.  Further inspection reveals that when optimization is turned
on, gcc decides to optimize out the chunk of inline assembler I use to verify
the AC bit was turned off.  When optimization is disabled, the chunk of inline
assembler re-appears.

The Intel C compiler v8.1 on the same machine does not exhibit this problem.

-- 
           Summary: Wrong code generated by gcc from inline assembler
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: inline-asm
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: thalakan at technologist dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-portbld-freebsd5.1
  GCC host triplet: i386-portbld-freebsd5.1
GCC target triplet: i386-portbld-freebsd5.1


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


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

* [Bug inline-asm/18450] Wrong code generated by gcc from inline assembler
  2004-11-12 11:01 [Bug inline-asm/18450] New: Wrong code generated by gcc from inline assembler thalakan at technologist dot com
@ 2004-11-12 11:09 ` thalakan at technologist dot com
  2004-11-12 12:46 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: thalakan at technologist dot com @ 2004-11-12 11:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From thalakan at technologist dot com  2004-11-12 11:08 -------
Created an attachment (id=7529)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7529&action=view)
Preprocessed source of program

This is the preprocessed source of the program.  Compile and run it with and
without optimization.  When optimization is turned on, the program will output
a nonzero value in the second line; this is wrong.

-- 


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


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

* [Bug inline-asm/18450] Wrong code generated by gcc from inline assembler
  2004-11-12 11:01 [Bug inline-asm/18450] New: Wrong code generated by gcc from inline assembler thalakan at technologist dot com
  2004-11-12 11:09 ` [Bug inline-asm/18450] " thalakan at technologist dot com
@ 2004-11-12 12:46 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-12 12:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-12 12:46 -------
Since the asm is not violate or have outputs which are used they are removed, this is not a bug:
  asm("	pushf\n"
      " orl %0, (%%esp)\n"
      "	popf\n"
      : : "i" (0x00040000));

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
   GCC host triplet|i386-portbld-freebsd5.1     |i386-portbld-freebsd5.1
         Resolution|                            |INVALID


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


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

end of thread, other threads:[~2004-11-12 12:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-12 11:01 [Bug inline-asm/18450] New: Wrong code generated by gcc from inline assembler thalakan at technologist dot com
2004-11-12 11:09 ` [Bug inline-asm/18450] " thalakan at technologist dot com
2004-11-12 12:46 ` pinskia at gcc dot gnu dot 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).