Bug 7873 - arm-linux-gcc fails when assigning address to a bit field
arm-linux-gcc fails when assigning address to a bit field
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: c
3.2
: P2 critical
: ---
Assigned To: Richard Earnshaw
: ice-on-valid-code
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2002-09-09 15:26 UTC by alex.zatsman
Modified: 2003-07-25 17:33 UTC (History)
2 users (show)

See Also:
Host: i386-pc-linux-gnu
Target: i386-pc-linux-gnu
Build: i386-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description alex.zatsman 2002-09-09 15:26:00 UTC
./arm-linux-gcc -c xxx2.c
xxx2.c: In function `foo':
xxx2.c:13: unrecognizable insn:
(insn 13 11 15 (set (reg:SI 34)
        (ashift:SI (symbol_ref:SI ("x0"))
            (const_int 12 [0xc]))) -1 (nil)
    (nil))
xxx2.c:13: Internal compiler error in extract_insn, at recog.c:2148
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

Release:
arm-linux-gcc v.3.2

Environment:
System: Linux tula 2.4.9 #1 SMP Fri Oct 26 14:37:41 EDT 2001 i686 unknown
Architecture: i686

	
host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: arm-linux set

How-To-Repeat:
/** Run "arm-linux-gcc -c" on this preprocessed segment : **/


unsigned int  x0  = 0;

typedef struct {
  unsigned int  field1 : 20;
  unsigned int  field2 : 12;
} XX;

static XX yy;

static void foo (void)
{
  yy.field1 = (unsigned int ) (&x0);
}
Comment 1 alex.zatsman 2002-09-09 15:26:00 UTC
Fix:
	You tell me :)
Comment 2 Richard Earnshaw 2002-09-10 08:47:00 UTC
Responsible-Changed-From-To: unassigned->rearnsha
Responsible-Changed-Why: .
Comment 3 Richard Earnshaw 2002-09-10 08:47:00 UTC
State-Changed-From-To: open->closed
State-Changed-Why: Fixed
Comment 4 Richard Earnshaw 2002-09-10 10:50:50 UTC
From: Richard Earnshaw <rearnsha@cambridge.arm.com>
To: alex.zatsman@analog.com
Cc: gcc-gnats@gcc.gnu.org, debian-gcc@lists.debian.org,
        Richard.Earnshaw@arm.com
Subject: Re: c/7873: arm-linux-gcc fails when assigning address to a bit 
 field
Date: Tue, 10 Sep 2002 10:50:50 +0100

 > >How-To-Repeat:
 > 
 > /** Run "arm-linux-gcc -c" on this preprocessed segment : **/
 > 
 > 
 > unsigned int  x0  = 0;
 > 
 > typedef struct {
 >   unsigned int  field1 : 20;
 >   unsigned int  field2 : 12;
 > } XX;
 > 
 > static XX yy;
 > 
 > static void foo (void)
 > {
 >   yy.field1 = (unsigned int ) (&x0);
 > }
 
 Please try the following patch:
 
 2002-09-10  Richard Earnshaw  <rearnsha@arm.com>
 
 	* arm.md (insv): Use reg_or_int_operand for operand[3].
 
 Index: arm.md
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.md,v
 retrieving revision 1.104
 diff -p -r1.104 arm.md
 *** arm.md	29 Jul 2002 12:41:46 -0000	1.104
 --- arm.md	10 Sep 2002 09:44:07 -0000
 ***************
 *** 1866,1872 ****
     [(set (zero_extract:SI (match_operand:SI 0 "s_register_operand" "")
                            (match_operand:SI 1 "general_operand" "")
                            (match_operand:SI 2 "general_operand" ""))
 !         (match_operand:SI 3 "nonmemory_operand" ""))]
     "TARGET_ARM"
     "
     {
 --- 1866,1872 ----
     [(set (zero_extract:SI (match_operand:SI 0 "s_register_operand" "")
                            (match_operand:SI 1 "general_operand" "")
                            (match_operand:SI 2 "general_operand" ""))
 !         (match_operand:SI 3 "reg_or_int_operand" ""))]
     "TARGET_ARM"
     "
     {
 
 

Comment 5 Richard Earnshaw 2002-09-10 15:39:45 UTC
From: rearnsha@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c/7873
Date: 10 Sep 2002 15:39:45 -0000

 CVSROOT:	/cvs/gcc
 Module name:	egcs
 Changes by:	rearnsha@gcc.gnu.org	2002-09-10 08:39:44
 
 Modified files:
 	gcc            : ChangeLog 
 	gcc/config/arm : arm.md 
 
 Log message:
 	PR c/7873
 	* arm.md (insv): Use reg_or_int_operand for operand[3].
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/egcs/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.15377&r2=1.15378
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/egcs/gcc/config/arm/arm.md.diff?cvsroot=gcc&r1=1.105&r2=1.106