[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: [avr-gcc-list] Compiler error

From: Haase Bjoern (PT-BEU/EMT) *
Subject: AW: [avr-gcc-list] Compiler error
Date: Mon, 30 May 2005 10:04:23 +0200

IMO the problem is not "C", but the way you use the non-standard extension of 
gcc allowing inline asm. Admittedly the error message gcc generates now is not 

IMO, in order to resolve the issue, one would need to teach gcc how to place 
3-Byte objects in registers. IMO this would require substantial changes in the 
back-end. Namely I think that among other things it would be necessary to 
introduce a new basic type with 3-Byte width. The TQFmode (three quarter 
floating point) possibly would do.

IMO, unless this is implemented, GCC will continue to assign mode BLKmode to 
3-Byte structs which requires them to be held in memory. I.e. they *always* 
will reside on the stack. This also implies that gcc would always require ldd 
and std instructions for accessing data members turning the use of such a union 
fairly inefficient.



-----Ursprüngliche Nachricht-----
Von: Larry Barello [mailto:address@hidden 
Gesendet: Montag, 30. Mai 2005 05:15
An: Haase Bjoern (PT-BEU/EMT) *; Joerg Wunsch; address@hidden
Betreff: RE: [avr-gcc-list] Compiler error

Ok, I submitted this as a bug (#21811) and within an hour it was closed as a
duplicate of #8788 which will be corrected in the 4.1.0 mainline.  #8788
sounds similar, but I am still somewhat unsatisfied since a union of a three
byte array and a word should be allowed in C.  Maybe I just didn't

-----Original Message-----
From: Haase Bjoern (PT-BEU/EMT) * [mailto:address@hidden
Sent: Monday, May 23, 2005 7:31 AM
To: Larry Barello; Joerg Wunsch; address@hidden
Subject: AW: [avr-gcc-list] Compiler error

I was able to reproduce your problem.
I assume that the underlying problem is, that gcc does assign the mode
BLKmode to your 3-Byte objects. It crashes since it does not know how to
place an object of mode BLKmode into registers: Blockmode is meant to be
used for memory blocks but also assigned to structs/unions of sizes that do
not exactly fit into int, long int or long long int variables.
Your asm code is forcing a BLKmode object into registers by using the "r"
constraint and there's the problem: GCC does not know how to place blocks of
memory into registers.
E.g. have a look how your object would be returned or passed as a function
parameter: GCC would probably never pass or return your union in registers
but allways in memory.

It's also not a problem of the avr port alone. The x86 port crashes as well
with your source code.

Short term (but shurly not most efficient) workaround would be to allocate 4
bytes for your union. In this case gcc will allocate a variable of mode
SImode and for this type of object, gcc knows how to place SImode objects
into registers. Other workaround would be to leave your object in memory.



-----Ursprüngliche Nachricht-----
Von: address@hidden
[mailto:address@hidden Im
Auftrag von Larry Barello
Gesendet: Montag, 23. Mai 2005 16:04
An: Joerg Wunsch; address@hidden
Betreff: RE: [avr-gcc-list] Compiler error

Nope, my problem seems much worse and is in the "asm" constraints handling.
Attached is all details.

-----Original Message-----
From:  Joerg Wunsch ...

What's the actual error message?  (And which compiler version?)

Maybe it's related to


reply via email to

[Prev in Thread] Current Thread [Next in Thread]