Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: SourceForge.net <noreply@so...> - 2012-01-10 06:58:41
|
Bugs item #3466784, was opened at 2011-12-28 20:13 Message generated for change (Comment added) made by epetrich You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=3466784&group_id=599 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: C-Front End >Group: fixed >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: rs9562 (rs9562) >Assigned to: Erik Petrich (epetrich) Summary: compile of library file cause seg violation Initial Comment: A new build of SDCC-3.1.0 with only mcs51 build enabled make[4]: Entering directory `/usr/local/src/sdcc/sdcc-3.1.0.test/device/lib' ../../bin/sdcc -I../../device/include -I../../device/include/mcs51 --model-large --nostdinc --std-c99 -c _atof.c -o large/_atof.rel Caught signal 11: SIGSEGV make[4]: *** [large/_atof.rel] Error 1 make[4]: Leaving directory `/usr/local/src/sdcc/sdcc-3.1.0.test/device/lib' The environment is Fedora 16, GCC 4.6.2. I had to add the patch level of "2" in SDCCicode.c so that the build would not hang. #if (defined(__linux__) || defined(__MINGW32__)) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 6 && (__GNUC_PATCHLEVEL__ == 0 || __GNUC_PATCHLEVEL__ == 1 || __GNUC_PATCHLEVEL__ == 2) #pragma GCC push_options #pragma GCC optimize ("O0") #endif Using strace gives more detail. I "cd" to "device/lib" and type strace ../../bin/sdcc -I../../device/include -I../../device/include/mcs51 --model-large --nostdinc --std-c99 -c _atof.c -o large/_atof.rel $ strace ../../bin/sdcc -I../../device/include -I../../device/include/mcs51 --model-large --nostdinc --std-c99 -c _atof.c -o large/_atof.rel execve("../../bin/sdcc", ["../../bin/sdcc", "-I../../device/include", "-I../../device/include/mcs51", "--model-large", "--nostdinc", "--std-c99", "-c", "_atof.c", "-o", "large/_atof.rel"], [/* 57 vars */]) = 0 brk(0) = 0x87ba000 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77aa000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/usr/local/lib/tls/i686/sse2/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat64("/usr/local/lib/tls/i686/sse2", 0xbfff9050) = -1 ENOENT (No such file or directory) open("/usr/local/lib/tls/i686/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat64("/usr/local/lib/tls/i686", 0xbfff9050) = -1 ENOENT (No such file or directory) open("/usr/local/lib/tls/sse2/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat64("/usr/local/lib/tls/sse2", 0xbfff9050) = -1 ENOENT (No such file or directory) open("/usr/local/lib/tls/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat64("/usr/local/lib/tls", 0xbfff9050) = -1 ENOENT (No such file or directory) open("/usr/local/lib/i686/sse2/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat64("/usr/local/lib/i686/sse2", 0xbfff9050) = -1 ENOENT (No such file or directory) open("/usr/local/lib/i686/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat64("/usr/local/lib/i686", 0xbfff9050) = -1 ENOENT (No such file or directory) open("/usr/local/lib/sse2/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat64("/usr/local/lib/sse2", 0xbfff9050) = -1 ENOENT (No such file or directory) open("/usr/local/lib/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat64("/usr/local/lib", {st_mode=S_IFDIR|0755, st_size=20480, ...}) = 0 open("/usr/lib/tls/i686/sse2/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls/i686/sse2", 0xbfff9050) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/i686/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls/i686", 0xbfff9050) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/sse2/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls/sse2", 0xbfff9050) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls", {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 0 open("/usr/lib/i686/sse2/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat64("/usr/lib/i686/sse2", 0xbfff9050) = -1 ENOENT (No such file or directory) open("/usr/lib/i686/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat64("/usr/lib/i686", 0xbfff9050) = -1 ENOENT (No such file or directory) open("/usr/lib/sse2/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat64("/usr/lib/sse2", {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 0 open("/usr/lib/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\1\1\1\3\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0000\256]I4\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=948524, ...}) = 0 mmap2(0x49592000, 972328, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x49592000 mmap2(0x49674000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xe2) = 0x49674000 mmap2(0x49679000, 26152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x49679000 close(3) = 0 open("/usr/local/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/usr/lib/sse2/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/usr/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/lib/tls/i686/sse2/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat64("/lib/tls/i686/sse2", 0xbfff9030) = -1 ENOENT (No such file or directory) open("/lib/tls/i686/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat64("/lib/tls/i686", 0xbfff9030) = -1 ENOENT (No such file or directory) open("/lib/tls/sse2/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat64("/lib/tls/sse2", 0xbfff9030) = -1 ENOENT (No such file or directory) open("/lib/tls/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat64("/lib/tls", {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 0 open("/lib/i686/sse2/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat64("/lib/i686/sse2", 0xbfff9030) = -1 ENOENT (No such file or directory) open("/lib/i686/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat64("/lib/i686", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 open("/lib/sse2/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat64("/lib/sse2", 0xbfff9030) = -1 ENOENT (No such file or directory) open("/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\1\1\1\3\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0 D\255H4\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=208320, ...}) = 0 mmap2(0x48ad0000, 172160, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x48ad0000 mmap2(0x48af9000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x28) = 0x48af9000 close(3) = 0 open("/usr/local/lib/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/usr/lib/sse2/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/usr/lib/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/lib/tls/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/lib/i686/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/lib/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0000o\261H4\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=115376, ...}) = 0 mmap2(0x48b15000, 116592, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x48b15000 mmap2(0x48b31000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b) = 0x48b31000 close(3) = 0 open("/usr/local/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/usr/lib/sse2/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/lib/tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/lib/i686/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\1\1\1\3\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\20\270\220H4\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=1991260, ...}) = 0 mmap2(0x488f2000, 1751644, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x488f2000 mprotect(0x48a97000, 4096, PROT_NONE) = 0 mmap2(0x48a98000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1a5) = 0x48a98000 mmap2(0x48a9b000, 10844, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x48a9b000 close(3) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77a9000 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77a8000 set_thread_area({entry_number:-1 -> 6, base_addr:0xb77a8700, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0 mprotect(0x48a98000, 8192, PROT_READ) = 0 mprotect(0x48af9000, 4096, PROT_READ) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77a7000 mprotect(0x49674000, 16384, PROT_READ) = 0 mprotect(0x488ee000, 4096, PROT_READ) = 0 rt_sigaction(SIGABRT, {0x8055890, [ABRT], SA_RESTART}, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGTERM, {0x8055890, [TERM], SA_RESTART}, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGINT, {0x8055890, [INT], SA_RESTART}, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGSEGV, {0x8055890, [SEGV], SA_RESTART}, {SIG_DFL, [], 0}, 8) = 0 brk(0) = 0x87ba000 brk(0x87db000) = 0x87db000 brk(0) = 0x87db000 open("_atof.c", O_RDONLY) = 3 access("../../bin/sdcpp", X_OK) = 0 pipe2([4, 5], O_CLOEXEC) = 0 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb77a8768) = 3567 close(5) = 0 fcntl64(4, F_SETFD, 0) = 0 brk(0) = 0x87db000 brk(0x87fc000) = 0x87fc000 brk(0) = 0x87fc000 brk(0x881d000) = 0x881d000 brk(0) = 0x881d000 brk(0x883e000) = 0x883e000 brk(0) = 0x883e000 brk(0x885f000) = 0x885f000 ioctl(4, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0xbffef918) = -1 EINVAL (Invalid argument) fstat64(4, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77a6000 read(4, "# 1 \"_atof.c\"\n# 1 \"<built-in>\"\n#"..., 4096) = 2855 read(4, "", 4096) = 0 brk(0) = 0x885f000 brk(0x8880000) = 0x8880000 read(4, "", 4096) = 0 brk(0) = 0x8880000 --- {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3567, si_status=0, si_utime=0, si_stime=0} (Child exited) --- brk(0x88a1000) = 0x88a1000 --- {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x2} (Segmentation fault) --- write(2, "Caught signal 11: SIGSEGV\n", 26Caught signal 11: SIGSEGV ) = 26 exit_group(1) = ? THE VERSION: $ ../../bin/sdcc -v SDCC : mcs51 3.1.0 #7066 (Dec 28 2011) (Linux) ---------------------------------------------------------------------- >Comment By: Erik Petrich (epetrich) Date: 2012-01-09 22:58 Message: It appears that in operandLitValue() gcc is generating the call to validateOpType with the parameters op, macro, and args passed in the eax, ecx, and edx registers and the parameters type and line passed on the stack. Parameter file is not being passed at all! However, the code generated for validateOpType() is assuming all of the parameters were passed on the stack. The segmentation fault is arising because what it assumes is the op pointer on the stack is actually the int line (since op wasn't even passed on the stack at all). This weirdness all seems to occur when the optimization level is switched from O2 to O0 after operandLitValue() is defined but not restored to O2 before validateOpType() is defined. That is, we need to add the check for "__GNUC_PATCHLEVEL__ == 2" both when switching to O0 as well as during the switch back to the previous optimization level. I'm not sure if this is another bug in gcc or if this is just an unclear limitation of "#pragma GCC optimize". It certainly seems odd that gcc is changing the usual calling convention (from parameters on stack only to registers and stack) for non-static functions. In any case, fixed in sdcc 3.1.1 #7195. ---------------------------------------------------------------------- Comment By: rs9562 (rs9562) Date: 2011-12-31 15:38 Message: I built SDCC-3.0.0 with the same system and tools. Built with no error and runs fine. Something new has been introduced that is causing this bug SDCC-3.1.0. ---------------------------------------------------------------------- Comment By: rs9562 (rs9562) Date: 2011-12-30 15:50 Message: I tested the latest source from the snap shot sdcc-src-20111229-7137.tar.bz2. Same thing happens. ---------------------------------------------------------------------- Comment By: rs9562 (rs9562) Date: 2011-12-29 17:51 Message: I used DDD to get a backtrace. I could not find a way to copy and paste so I am typing the trace line by line: main() at SDCCmain.c :2491 yyparse() at SDCC.y:189 createFunction() at SDCCast.c:6624 iCodeFromAst() at SDCCicode.c:4415 ast2iCode(lvl = 0) at SDCCicode.c:4356 geniCodeFunctionBody() at SDCCicode.c:3479 ast2iCode(lvl = 1) at SDCCicode.c:4030 . . . ast2iCode(lvl = 14) at SDCCicode.c:4263 geniCodeAssign() at SDCCicode.c:3120 checkTypes() at SDCCicode.c:3100 geniCodeCast() at SDCCicode.c:1965 operandLitValue() at SDCCicode.c:1097 validateOpType(op=0x2, macro=0x449, <address 0x449 out of bounds>, args=0xffffffff <Address 0xffffffff out of bounds>, type = SYMBOL, line=136168488, file=0x80fe0c5, "SDCCicode.c") at SDCCicode.c: 4438 sig_handler(signal = 11) at SDCCmain.c:2378 ---------------------------------------------------------------------- Comment By: rs9562 (rs9562) Date: 2011-12-29 09:22 Message: The configure command line was: ./configure --disable-z80-port --disable-z180-port --disable-r2k-port --disable-gbz80-port --disable-ds390-port --disable-ds400-port --disable-pic14-port --disable-pic16-port --disable-hc08-port --enable-doc The change made to SDDCicode.c was minor, so that the build would not hang. The GCC 4.6.2 has the same hang up problem as GCC 4.6.1. I added "|| __GNUC_PATCHLEVEL__ == 2". /* This seems to be a GCC 4.6.[01] bug on i386 Linux and mingw platforms * see http://sourceforge.net/tracker/?func=detail&aid=3285611&group_id=599&atid=300599 */ #if (defined(__linux__) || defined(__MINGW32__)) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 6 && (__GNUC_PATCHLEVEL__ == 0 || __GNUC_PATCHLEVEL__ == 1 || __GNUC_PATCHLEVEL__ == 2) #pragma GCC push_options #pragma GCC optimize ("O0") #endif The GCC 4.6.2 configuration is: $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-redhat-linux/4.6.2/lto-wrapper Target: i686-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-redhat-linux Thread model: posix gcc version 4.6.2 20111027 (Red Hat 4.6.2-1) (GCC) The GCC 4.6.2 has been used to build a recent kernel source tree from (3.1.6) from kernel.org and has compiled numerous other applications and libraries. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=3466784&group_id=599 |