public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/14090] New: inline asm statement only compiles with -O
@ 2004-02-10 0:17 weimer at cs dot berkeley dot edu
2004-02-10 1:16 ` [Bug c/14090] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: weimer at cs dot berkeley dot edu @ 2004-02-10 0:17 UTC (permalink / raw)
To: gcc-bugs
The following 18-line program (adapted from the linux 2.4.24 scheduler) compiles
with "gcc -c -O min.c" but does not compile with "gcc -c min.c" on x86/linux. It
is my belief that -O should not change the set of acceptable programs. It seems
unlikely that you'll be able to "fix" this, but I think it at least worth
documenting (in the reported error message itself, if possible). Thanks!
/* begin: min.c */
struct thread_struct {
unsigned long eip ;
unsigned long esp ;
};
struct task_struct {
struct thread_struct thread ;
};
void ( __attribute__((__regparm__(0))) schedule)(void)
{ struct schedule_data *sched_data ;
struct task_struct *prev ;
struct task_struct *next ;
__asm__ volatile ("nop":
"=m" (prev->thread.esp),
"=m" (prev->thread.eip),
"=b" (prev):
"m" (next->thread.esp), "m" (next->thread.eip),
"a" (prev), "d" (next), "b" (prev));
}
/* eof: min.c */
Here's a log of it failing to compile without -O on a newly-built gcc 3.3.2, and
then working with -O. Same behavior (slightly different error message: "fixed or
forbidden register 6 (bp) was spilled for class GENERAL_REGS") with gcc 2.95.4.
afflatus:/scratch/weimer/linux-2.4.24/delta$ /scratch/weimer/gcc/bin/gcc -v -c
min.c
Reading specs from
/scratch/weimer/gcc/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.3.2/specs
Configured with: ./configure --prefix /scratch/weimer/gcc/
Thread model: posix
gcc version 3.3.2
/scratch/weimer/gcc/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.3.2/cc1 -quiet -v
-iprefix /scratch/weimer/gcc/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.3.2/
-D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=2 min.c -quiet -dumpbase
min.c -auxbase min -version -o /tmp/ccQ3IXgq.s
GNU C version 3.3.2 (i686-pc-linux-gnu)
compiled by GNU C version 2.95.4 20011002 (Debian prerelease).
GGC heuristics: --param ggc-min-expand=90 --param ggc-min-heapsize=113214
ignoring nonexistent directory "/scratch/weimer/gcc/i686-pc-linux-gnu/include"
ignoring nonexistent directory "/scratch/weimer/gcc/i686-pc-linux-gnu/include"
ignoring duplicate directory
"/scratch/weimer/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include"
#include "..." search starts here:
#include <...> search starts here:
/scratch/weimer/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include
/usr/local/include
/scratch/weimer/gcc/include
/usr/include
End of search list.
min.c: In function `schedule':
min.c:12: error: can't find a register in class `GENERAL_REGS' while reloading `asm'
afflatus:/scratch/weimer/linux-2.4.24/delta$ /scratch/weimer/gcc/bin/gcc -v -c
min.c -O
Reading specs from
/scratch/weimer/gcc/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.3.2/specs
Configured with: ./configure --prefix /scratch/weimer/gcc/
Thread model: posix
gcc version 3.3.2
/scratch/weimer/gcc/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.3.2/cc1 -quiet -v
-iprefix /scratch/weimer/gcc/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.3.2/
-D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=2 min.c -quiet -dumpbase
min.c -auxbase min -O -version -o /tmp/ccgEur4n.s
GNU C version 3.3.2 (i686-pc-linux-gnu)
compiled by GNU C version 2.95.4 20011002 (Debian prerelease).
GGC heuristics: --param ggc-min-expand=90 --param ggc-min-heapsize=113214
ignoring nonexistent directory "/scratch/weimer/gcc/i686-pc-linux-gnu/include"
ignoring nonexistent directory "/scratch/weimer/gcc/i686-pc-linux-gnu/include"
ignoring duplicate directory
"/scratch/weimer/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include"
#include "..." search starts here:
#include <...> search starts here:
/scratch/weimer/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include
/usr/local/include
/scratch/weimer/gcc/include
/usr/include
End of search list.
as -V -Qy -o min.o /tmp/ccgEur4n.s
GNU assembler version 2.12.90.0.1 (i386-linux) using BFD version 2.12.90.0.1
20020307 Debian/GNU Linux
afflatus:/scratch/weimer/linux-2.4.24/delta$ ls -la min.o
-rw-rw-r-- 1 weimer weimer 584 Feb 9 16:10 min.o
--
Summary: inline asm statement only compiles with -O
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: weimer at cs dot berkeley dot edu
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14090
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/14090] inline asm statement only compiles with -O
2004-02-10 0:17 [Bug c/14090] New: inline asm statement only compiles with -O weimer at cs dot berkeley dot edu
@ 2004-02-10 1:16 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-10 1:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-02-10 01:16 -------
This is a dup of bug 11203.
*** This bug has been marked as a duplicate of 11203 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14090
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-02-10 1:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-10 0:17 [Bug c/14090] New: inline asm statement only compiles with -O weimer at cs dot berkeley dot edu
2004-02-10 1:16 ` [Bug c/14090] " 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).