Strange behavior of gcc-3.1
Agust Karlsson
Gusti@pallas.dk
Tue Jul 23 03:41:00 GMT 2002
I have just upgraded my gcc from 2.96 (RedHat 7.2 distribution) to 3.1
(compiled from source with prefix=/usr)
Oddly, things that did work OK before seem to fail now.
I have included an example with the error messages I get.
Does someone have a clou on what's happened???
----------------------------------------------------------------------------
----------
struct Data {
int var[10];
};
void f1( int *param)
{ int p;
p = param[ 7];
if (( 7<=p) && (p<= 14))
Data.var[ 7] = p;
// p = param[ 9]; // any of these two lines
// if (( 5<=p) && (p<= 30)) // can provoke the error in the next line
Data.var[ 9] = p;
}
// ---------------------------
// how to declare and use a packed enum ?
typedef enum { v11=1, v12=2 } e1 __attribute__ ((packed));
void g1( e1 par) {}
enum e2 { v21=1, v22=2} __attribute ((packed));
void g2( e2 par) {}
----------------------------------------------------------------------------
--------------------------------------------
This is the output from g++ -c test.cpp :
test.cpp: In function `void f1(int*)':
test.cpp:9: parse error before `.' token
test.cpp: At global scope:
test.cpp:20: non-local function `void g1(<anonymous enum>)' uses anonymous
type
test.cpp:22: semicolon missing after declaration of `e2'
--
Agust Karlsson mailto:gusti@pallas.dk
Pallas Informatik A/S http://www.pallas.dk
Allerød Stationsvej 2D Tel.: +45 48 10 24 10
DK-3450 Allerød Fax.: +45 48 10 24 01
More information about the Gcc-help
mailing list