Summary: | [4.4/bad-code?] sys-devel/gcc: gfortran: character constant declared in a module does not transfer correctly | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Wirawan Purwanto <wirawan0> |
Component: | [OLD] Core system | Assignee: | Gentoo Toolchain Maintainers <toolchain> |
Status: | RESOLVED OBSOLETE | ||
Severity: | normal | CC: | Hloupy.Honza |
Priority: | High | ||
Version: | 10.0 | ||
Hardware: | AMD64 | ||
OS: | Linux | ||
URL: | http://gcc.gnu.org/PR43146 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
emerge --info output
306833.F90: fortran test case |
Description
Wirawan Purwanto
2010-02-25 15:31:26 UTC
Created attachment 221153 [details]
emerge --info output
I originally started out with Sabayon, but then forked from them by continuing to build my own package a la Gentoo--thus, the bug was reported against gentoo and not sabayon.
gfortan version info: ~/toys/gfortran/ch10 $ gfortran -v Using built-in specs. Target: x86_64-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-4.4.3/work/gcc-4.4.3/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.4.3 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.3 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.3/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.3/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --enable-multilib --enable-libmudflap --disable-libssp --enable-libgomp --enable-cld --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.4.3/python --enable-objc-gc --enable-languages=c,c++,java,objc,obj-c++,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.4.3 p1.0' Thread model: posix gcc version 4.4.3 (Gentoo 4.4.3 p1.0) OK. No progress yet. :( Now I am building gcc 4.4.3 plain vanilla on my gentoo box. I used the gcc-4.4.3 that I built on this machine using the following ebuild: EBUILD gcc-4.4.3.ebuild 2362 RMD160 dcb7e675c30d26fbc714fb27a4935773b74b8bc1 SHA1 da0c26e43e3a10829c345260e834504b36534eee SHA256 bf25a37a1461a1c9e269c926896a8f54490a37a33a4527965cfe4bd37a4eae24 The output of gcc -v is: Using built-in specs. Target: x86_64-unknown-linux-gnu Configured with: ./configure --prefix=/usr/local/gcc-4.4.3 --enable-languages=c,fortran,c++ Thread model: posix gcc version 4.4.3 (GCC) I compiled testme7.F90 that I supplied in an earlier communication and here's the result: ~/toys/gfortran/ch10/gfortran-4.4.3-vanilla-gentoo $ cat testme7.s .file "testme7.F90" .text .globl xx_ .type xx_, @function xx_: .LFB0: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 movq %rsp, %rbp .cfi_offset 6, -16 .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movl %esi, -12(%rbp) movq -8(%rbp), %rax movb $10, (%rax) leave ret .cfi_endproc .LFE0: .size xx_, .-xx_ .ident "GCC: (GNU) 4.4.3" .section .note.GNU-stack,"",@progbits Voila! It is correct now. Thus there must be a bug somewhere in the patched GCC 4.4.3 in Gentoo version. (In reply to comment #3) For me vanilla did not help. Since it appears it's going to take me some time before I report all the details properly, I'll at least mention one observation for now: Gfortrans up to 4.3.x work well for me, 4.4.x does not. Both *.s and *.mod formats changed between 4.3 and 4.4, the important change being the way character constants are saved in the fortran modules. Up to 4.3 series, gfortran used to simply save all the characters in the modules as they were. 4.4 series saves printable characters as they are, while non-printable ones are saved as escaped unicode strings, char(10) becoming '\U0000000a'. Apparently, gfortran does not parse well the modules it has itself created. When I edited the blahblah.mod created by `gfortran -S testme7.F90`, replacing the escape string by the character itself, subsequent `gfortran -S testme7.F90` produced the correct testme7.s Created attachment 234815 [details]
306833.F90: fortran test case
to summarize, this test case with gcc-4.4.[0-4] results in:
$ gfortran-4.4.4 306833.F90
$ ./a.out | od -t x1 -N 1
0000000 00
that 00 should be 0a. gcc-4.3.x and gcc-4.5.x results in correct output. x86 and x86_64 behave the same way.
vanilla gcc-4.4.4 (no Gentoo patches) gives same behavior. trick seems to be in the configure options used. specifically, --disable-checking. cc back amd64 if you need our support. seems to be working for me with newer libs. presumably a bug in gmp/mpfr that is now fixed. |