public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* #pragma pack() problems with gcc-2.95 19990608 on sparc-redhat-linux
@ 1999-06-30 23:07 GUYOMARCH Rémi
0 siblings, 0 replies; 2+ messages in thread
From: GUYOMARCH Rémi @ 1999-06-30 23:07 UTC (permalink / raw)
To: 'egcs-bugs'
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1215 bytes --]
Here's a little test case which fail on gcc-2.95 19990608 but succeed on
egcs 1.1.2 on the same platform (sparc-redhat-linux RH 5.2).
With gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release) :
$ gcc -g -Wall zz.cpp ; ./a.out
struct: 0x208c0
logfiletype: 0x208c4
With gcc version gcc-2.95 19990608 (prerelease) :
$ egcc -g -Wall zz.cpp ; ./a.out
struct: 0x208c0
logfiletype: 0x208c1 <-- int not aligned
Bus error (core dumped)
Yes, I know pragmas are evil, but this used to work with egcs 1.1.2.
Btw, the info docs say that #pragma(0) should reset alignment to the
defaults, but both compiler complains about a bad pragma.
Here's the source :
--------------------------
#include <stdio.h>
#pragma pack(1)
struct {
char toto;
int titi;
char tata[3];
} zz3;
#pragma pack()
struct {
char percprint;
int logfileType;
} logstatics;
void update( int *z ) { *z = 1; }
int main( void ) {
printf( "struct: %p\n"
"logfiletype: %p\n",
&logstatics, &logstatics.logfileType );
update( &logstatics.logfileType );
}
--------------------------
--
Rémi Guyomarch
LAN / Network Admin
Inventaire Forestier National
French National Forest Inventory
http://www.ifn.fr/
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: #pragma pack() problems with gcc-2.95 19990608 on sparc-redhat-linux
@ 1999-06-16 8:09 GUYOMARCH Rémi
0 siblings, 0 replies; 2+ messages in thread
From: GUYOMARCH Rémi @ 1999-06-16 8:09 UTC (permalink / raw)
To: 'egcs-bugs'
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2659 bytes --]
btw, It's probably the same bug which was reported in
http://egcs.cygnus.com/ml/egcs-bugs/1999-05/msg00488.html
and
http://egcs.cygnus.com/ml/egcs-bugs/1999-05/msg00046.html
> -----Original Message-----
> From: GUYOMARCH Rémi
> Sent: Wednesday, June 16, 1999 5:00 PM
> To: 'egcs-bugs'
> Subject: #pragma pack() problems with gcc-2.95 19990608 on
> sparc-redhat-linux
>
> Here's a little test case which fail on gcc-2.95 19990608 but succeed on
> egcs 1.1.2 on the same platform (sparc-redhat-linux RH 5.2).
>
> With gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release) :
>
> $ gcc -g -Wall zz.cpp ; ./a.out
> struct: 0x208c0
> logfiletype: 0x208c4
>
> With gcc version gcc-2.95 19990608 (prerelease) :
>
> $ egcc -g -Wall zz.cpp ; ./a.out
> struct: 0x208c0
> logfiletype: 0x208c1 <-- int not aligned
> Bus error (core dumped)
>
>
> Yes, I know pragmas are evil, but this used to work with egcs 1.1.2.
> Btw, the info docs say that #pragma(0) should reset alignment to the
> defaults, but both compiler complains about a bad pragma.
>
> Here's the source :
> --------------------------
> #include <stdio.h>
>
> #pragma pack(1)
> struct {
> char toto;
> int titi;
> char tata[3];
> } zz3;
> #pragma pack()
>
> struct {
> char percprint;
> int logfileType;
> } logstatics;
>
> void update( int *z ) { *z = 1; }
>
> int main( void ) {
> printf( "struct: %p\n"
> "logfiletype: %p\n",
> &logstatics, &logstatics.logfileType );
> update( &logstatics.logfileType );
> }
> --------------------------
>
> --
> Rémi Guyomarch
> LAN / Network Admin
> Inventaire Forestier National
> French National Forest Inventory
> http://www.ifn.fr/
>
>From khan@xraylith.wisc.EDU Wed Jun 16 08:44:00 1999
From: Mumit Khan <khan@xraylith.wisc.EDU>
To: GUYOMARCH Rémi <rguyomarch@ifn.fr>
Cc: "'egcs-bugs'" <egcs-bugs@egcs.cygnus.com>
Subject: Re: #pragma pack() problems with gcc-2.95 19990608 on sparc-redha t-linux
Date: Wed, 16 Jun 1999 08:44:00 -0000
Message-id: <199906161437.JAA23220@mercury.xraylith.wisc.edu>
References: <73B62B5669A9D2119B230090273A92AD05F0@quercus.ifn.fr>
X-SW-Source: 1999-06/msg00461.html
Content-length: 468
=?iso-8859-1?Q?GUYOMARCH_R=E9mi?= <rguyomarch@ifn.fr> writes:
>
> btw, It's probably the same bug which was reported in=20
> http://egcs.cygnus.com/ml/egcs-bugs/1999-05/msg00488.html
> and
> http://egcs.cygnus.com/ml/egcs-bugs/1999-05/msg00046.html
>
This should be fixed in post-1999-06-09 CVS or snapshots.
Wed Jun 9 03:10:34 1999 Mumit Khan <khan@xraylith.wisc.edu>
* c-pragma.c (handle_pragma_token): Handle `#pragma pack()'
correctly.
Regards,
Mumit
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1999-06-30 23:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-30 23:07 #pragma pack() problems with gcc-2.95 19990608 on sparc-redhat-linux GUYOMARCH Rémi
-- strict thread matches above, loose matches on Subject: below --
1999-06-16 8:09 GUYOMARCH Rémi
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).