Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 8788
Product:  
Component:  
Status: RESOLVED
Resolution: FIXED
Assigned To: Not yet assigned to anyone <unassigned@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: killer.lightspeed@bigpond.com
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
testasm.c Example: Referring a struct from inline assembler w/ workaround text/plain 2004-05-12 08:09 1.08 KB Edit
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 8788 depends on: Show dependency tree
Show dependency graph
Bug 8788 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: 2005-02-14 02:04 Opened: 2002-12-02 09:26
GCC encounters an internal compiler error instead of reporting an error when it
encounters an attempt to fit a 192-bit structure into a 32-bit register.

E:\DJGPP\bugs>gcc -v -save-temps -c test2.c
Reading specs from e:/djgpp/lib/gcc-lib/djgpp/3.21/specs
Configured with: /devel/gnu/gcc/3.2/gnu/gcc-3.21/configure i586-pc-msdosdjgpp
--prefix=/dev/env/DJDIR --disable-nls
Thread model: single
gcc version 3.2.1
 e:/djgpp/lib/gcc-lib/djgpp/3.21/cpp0.exe -lang-c -v -D__GNUC__=3
-D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=1 -D__GXX_ABI_VERSION=102 -D__MSDOS__
-D__GO32__ -D__DJGPP__=2 -D__unix__ -D__MSDOS__ -D__GO32__ -D__DJGPP__=2
-D__unix__ -Asystem=msdos -Asystem=unix -D__NO_INLINE__ -D__STDC_HOSTED__=1
-Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i586__
-D__tune_pentium__ -DMSDOS -DGO32 -DDJGPP=2 -Dunix -remap -imacros
e:/djgpp/lib/gcc-lib/djgpp/3.21/djgpp.ver test2.c test2.i
GNU CPP version 3.2.1 (cpplib) (80386, BSD syntax)
ignoring nonexistent directory "e:/djgpp/djgpp/include"
#include "..." search starts here:
#include <...> search starts here:
 e:/djgpp/lib/gcc-lib/djgpp/3.21/include
 e:/djgpp/include
End of search list.
 e:/djgpp/lib/gcc-lib/djgpp/3.21/cc1.exe -fpreprocessed test2.i -quiet
-dumpbase test2.c -version -o test2.s
GNU CPP version 3.2.1 (cpplib) (80386, BSD syntax)
GNU C version 3.2.1 (djgpp)
        compiled by GNU C version 3.2.1.
test2.c: In function `switch_to_stack':
test2.c:10: Internal compiler error in emit_move_insn, at expr.c:2771
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

Release:
gcc version 3.2.1

Environment:
OS: Windows 98 [Version 4.10.2222]
CPU: AuthenticAMD AMD-K6(tm) 3D processor
RAM: 160.0MB RAM
Distribution: MS-DOS DJGPP v2

How-To-Repeat:
Invoked with:
gcc -v -save-temps -c test2.c
Preprocessed source (test2.i):
# 1 "test2.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "e:/djgpp/lib/gcc-lib/djgpp/3.21/djgpp.ver" 1
# 1 "e:/djgpp/include/sys/version.h" 1 3
# 2 "e:/djgpp/lib/gcc-lib/djgpp/3.21/djgpp.ver" 2
# 2 "<command line>" 2
# 1 "test2.c"
typedef struct {
    long x[6];
} myjmp_buf;

typedef struct {
    myjmp_buf regs;
} my_stack;

void switch_to_stack (my_stack *stack){
    asm (
        "\n"
        : "+a" (stack->regs)
    );
}

------- Comment #1 From Wolfgang Bangerth 2002-12-02 13:32 -------
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed. Also happens on Linux and with all versions
    of gcc since at least 2.95

------- Comment #2 From Andrew Pinski 2003-05-29 17:39 -------
moving to inline-asm because that is where it belongs.

------- Comment #3 From Andrew Pinski 2003-07-11 20:37 -------
This does not ICE but  gives "inconsistent operand constraints in an `asm'" in
2.91.66 so 
this is a regression with respect to that, it happens in 2.95.3 also so it was
introduced in 
between.

------- Comment #4 From Andrew Pinski 2003-07-11 23:36 -------
This happens on all i?86-*-*.

------- Comment #5 From Andrew Pinski 2003-07-13 19:53 -------
Since this is an ice-on-invalid-code regression moving target to 3.3.2.

------- Comment #6 From Falk Hueffner 2003-08-18 19:40 -------
This happens with any struct that has more than one element:

void f(){
    struct { char x, y; } s;
    asm ("" : : "r" (s));
}

The documentation is not quite clear about what's legal here, I think it would  
be best to document that one-element structs are OK for "r" (because people are  
likely using that at the moment), and reject all other structs with a useful  
error message.

------- Comment #7 From Falk Hueffner 2003-08-18 19:41 -------
*** Bug 9233 has been marked as a duplicate of this bug. ***

------- Comment #8 From Falk Hueffner 2003-08-18 19:41 -------
*** Bug 11896 has been marked as a duplicate of this bug. ***

------- Comment #9 From Andrew Pinski 2003-10-06 21:11 -------
*** Bug 12530 has been marked as a duplicate of this bug. ***

------- Comment #10 From Mark Mitchell 2003-10-16 02:40 -------
Postponed until GCC 3.3.3.

------- Comment #11 From Eric Botcazou 2003-12-12 09:48 -------
It fails in GCC 2.95.x and all 3.x releases and I think it is not worth while
to
tweak the middle-end on a release branch for such a pathological case.

------- Comment #12 From Andrew Pinski 2003-12-20 08:36 -------
A regression from 2.91 is not really worth being mentioned as this is an
ice-on-invalid-
code.

------- Comment #13 From Falk Hueffner 2004-04-25 15:53 -------
*** Bug 15131 has been marked as a duplicate of this bug. ***

------- Comment #14 From Andrew Pinski 2004-04-25 17:30 -------
*** Bug 15136 has been marked as a duplicate of this bug. ***

------- Comment #15 From Mogens Dybęk Christensen 2004-05-12 08:09 -------
Created an attachment (id=6262) [edit]
Example: Referring a struct from inline assembler w/ workaround

This simplified code produces "Internal Compiler Error" on gcc 3.3.1/cygwin
(and other versions). The bug is present also when renaming and compiling the
file as C++.

A possible workaround seems to be adding '&' in the macro invocation, which
also seems more correct, since this is about passing a pointer in a register.

------- Comment #16 From Andrew Pinski 2005-04-08 06:26 -------
*** Bug 20818 has been marked as a duplicate of this bug. ***

------- Comment #17 From CVS Commits 2005-05-09 05:16 -------
Subject: Bug 8788

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	sayle@gcc.gnu.org	2005-05-09 05:15:51

Modified files:
	gcc            : ChangeLog stmt.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: pr8788-1.c 

Log message:
	PR inline-asm/8788
	* stmt.c (expand_asm_operands): Avoid calling force_reg on BLKmode
	operands.
	
	* gcc.dg/pr8788-1.c: New testcase.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8666&r2=2.8667
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stmt.c.diff?cvsroot=gcc&r1=1.421&r2=1.422
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5447&r2=1.5448
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr8788-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1


------- Comment #18 From Andrew Pinski 2005-05-29 23:48 -------
*** Bug 21811 has been marked as a duplicate of this bug. ***

------- Comment #19 From Andrew Pinski 2005-05-29 23:48 -------
Fixed on the mainline for 4.1.0.

------- Comment #20 From Andrew Pinski 2006-02-02 17:13 -------
*** Bug 26077 has been marked as a duplicate of this bug. ***

------- Comment #21 From Andrew Pinski 2006-07-28 23:48 -------
*** Bug 28529 has been marked as a duplicate of this bug. ***

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug