[Bug 629092] Re: gcc 4.3.2 compiler included with kubuntu fails on simple structure
Matthias Klose
doko at ubuntu.com
Wed Jun 11 13:15:04 UTC 2014
** Changed in: gcc-defaults (Ubuntu)
Status: New => Invalid
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-defaults in Ubuntu.
https://bugs.launchpad.net/bugs/629092
Title:
gcc 4.3.2 compiler included with kubuntu fails on simple structure
Status in “gcc-defaults” package in Ubuntu:
Invalid
Bug description:
I have simple test case of a program which manifests a problem I have
in a much larger program.
The problem is something to do with structure member access when one
of he members is 64 bits long. I've (tried to) include three files
which easily reproduce the problem: main.c testrio.c and testrio.h
I got kubuntu from a CD in "The official Ubuntu Book". I don't know which version it is. I subsequently installed the the gcc compiler via the GUI. Things seemed to work well. In fact I tested it on several simple programs. When I started to build my main project - I had problems which I have distilled to this simple test. You can only imagine the amount of time it takes to isolate this. gcc -v produces
ramey at Robert-Desktop:~/psort/nix/linux/testrio$ gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.2-1ubuntu12'
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++
,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexec
dir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --wi
th-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=g
nu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all
--enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=
i486-linux-gnu
Thread model: posix
gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu12)
The attachment system here only lets me include one file. I've
concatonated the three files here instead:
/******** testrio.h **********/
#ifndef __TESTRIO__
#define __TESTRIO__
#define _FILE_OFFSET_BITS 64
#include <sys/types.h> /* off_t */
typedef struct {
off_t fs;
unsigned int i1;
unsigned int i2;
} TESTRIO;
extern int
rio_init(TESTRIO *rio);
#endif /* __TESTRIO__ */
/********* testrio.c ***********/
#include "testrio.h"
extern int
rio_init(TESTRIO *rio){
rio->fs = (off_t)(-1);
rio->i1 = 1;
rio->i2 = 2;
return 0;
}
/********* main.c ************/
#include <stdio.h> /* printf */
#include "testrio.h"
int
main(
int argc,
char *argv[]
){
TESTRIO rio;
rio_init(&rio);
printf("i1=%u, i2=%u\n", rio.i1, rio.i2);
return 0;
}
I use the following command line to build this test:
gcc -ggdb -o testrio main.c testrio.c
I run the test with:
ramey at Robert-Desktop:~/psort/nix/linux/testrio$ ./testrio
i1=4294967295, i2=1
Bus error
As you can see, the output is not what one would expect from looking
at testrio.c
Please suggest to me what I should do.
Thank you.
Robert Ramey
PS. I've compiled the same programs on my cygwin gcc 4.32 compiler with no surprises or problems. It is for this reason I suspect the gcc version distributed with ubuntu.
RR
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/629092/+subscriptions
More information about the foundations-bugs
mailing list