Issue Details (XML | Word | Printable)

Key: PCC-353
Type: Bug Bug
Status: Closed Closed
Resolution: Cannot Reproduce
Priority: Major Major
Assignee: Anders Magnusson
Reporter: Susi Lehtola
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
pcc

Binaries compiled by PCC segfault in Fedora 15

Created: 27/May/11 10:52 AM   Updated: Yesterday 06:06 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

File Attachments: 1. GZip Archive compile.log.gz (5 kB)
2. File objs.tar.bz2 (3 kB)



 Description  « Hide
Referring to
 https://bugzilla.redhat.com/show_bug.cgi?id=708305
binaries compiled by PCC do not work in Fedora 15 (glibc 2.13.90). PCC works fine in Fedora 14 (glibc-2.13).

Example: A Hello World program (a.c)

#include <stdio.h>
int main()
{
    printf("Hello\n");
    return 0;
}

compiled with
 $ pcc a.c
and run with
 $ ./a.out

results in
 Hello
in Fedora 14 x86_64, but
 $ ./a.out
 Segmentation fault (core dumped)
in Fedora 15.

Output of $valgrind ./a.out

==4974== Process terminating with default action of signal 11 (SIGSEGV)
==4974== Access not within mapped region at address 0x0
==4974== at 0x1: ???
==4974== by 0x40042D: __do_global_ctors_aux (in /tmp/a.out)
==4974== by 0x40034D: ??? (in /tmp/a.out)
==4974== by 0xE2: ???
==4974== by 0x400554: __libc_csu_init (in /tmp/a.out)
==4974== by 0x34892213CF: (below main) (libc-start.c:185)
==4974== If you believe this happened as a result of a stack
==4974== overflow in your program's main thread (unlikely but
==4974== possible), you can try to increase the size of the
==4974== main thread stack using the --main-stacksize= flag.
==4974== The main thread stack size used in this run was 8388608.


 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Susi Lehtola added a comment - 29/May/11 10:32 AM
Using the 20110529 CVS snapshot of PCC, the output of the example program is

$ ./a.out
Hello
Segmentation fault (core dumped)

Valgrind reports


==11448== Use of uninitialised value of size 8
==11448== at 0x3488E0F220: _dl_fini (dl-fini.c:217)
==11448== by 0x3489239930: __run_exit_handlers (exit.c:78)
==11448== by 0x34892399B4: exit (exit.c:100)
==11448== by 0x3489221443: (below main) (libc-start.c:258)
==11448==
==11448== Use of uninitialised value of size 8
==11448== at 0x3488E0F2CD: _dl_fini (dl-fini.c:268)
==11448== by 0x3489239930: __run_exit_handlers (exit.c:78)
==11448== by 0x34892399B4: exit (exit.c:100)
==11448== by 0x3489221443: (below main) (libc-start.c:258)
==11448==
==11448==
==11448== Process terminating with default action of signal 11 (SIGSEGV)
==11448== Bad permissions for mapped region at address 0x3488E0F3D0
==11448== at 0x3488E0F2CD: _dl_fini (dl-fini.c:268)
==11448== by 0x3489239930: __run_exit_handlers (exit.c:78)
==11448== by 0x34892399B4: exit (exit.c:100)
==11448== by 0x3489221443: (below main) (libc-start.c:258)

Gregory McGarry added a comment - 30/May/11 04:16 AM
I'm guessing that you need to pull-up the csu fixes from pcc-devel.

Susi Lehtola added a comment - 30/May/11 06:26 AM
No, I get the segfault with the 20110530 snapshot as well.

What do mean by csu fixes?

Gregory McGarry added a comment - 31/May/11 07:36 AM
csu fixes were made to pcc-libs repository.

Which version of pcc are you using? pcc -v would tell.


Susi Lehtola added a comment - 31/May/11 11:02 AM
$ pcc -v
pcc 1.1.0.DEVEL 20110530 for x86_64-unknown-linux-gnu, mockbuild@
no input files

as I stated above.

Sam Hegarty added a comment - 15/Jun/11 06:39 AM
I can not reproduce this with pcc 1.1.0.DEVEL 20110612. It appears to have been resolved.

Susi Lehtola added a comment - 15/Jun/11 09:23 AM
20110615 still segfaults on Fedora 15.

Sam Hegarty added a comment - 16/Jun/11 09:10 AM
I'm also using Fedora 15. Did you install an updated pcc-libs along with an updated pcc?

Susi Lehtola added a comment - 16/Jun/11 03:30 PM
Yes, I did.

Gregory McGarry added a comment - 11/Jul/11 02:14 AM
$ uname -a
Linux fedora15 2.6.38.6-26.rc1.fc15.x86_64 #1 SMP Mon May 9 20:45:15 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
$ cat hw.c
#include <stdio.h>
int
main(void)
{
        printf("hello world\n");
        return 0;
}
$ pcc hw.c
$ ./a.out
hello world
$ ident a.out
a.out:
     $Id: crtbegin.c,v 1.7 2011/04/12 04:44:19 gmcgarry Exp $
     $Id: crtend.c,v 1.4 2011/04/12 04:44:19 gmcgarry Exp $

Susi Lehtola added a comment - 11/Jul/11 11:20 AM
$ uname -r
2.6.38.8-32.fc15.x86_64
$ ./a.out
hello world
Segmentation fault (core dumped)
$ ident a.out
a.out:
     $Id: crtbegin.c,v 1.7 2011/04/12 04:44:19 gmcgarry Exp $
     $Id: crtend.c,v 1.4 2011/04/12 04:44:19 gmcgarry Exp $

Susi Lehtola added a comment - 11/Jul/11 11:21 AM
PCC compilation log.

Gregory McGarry added a comment - 01/Aug/11 02:29 AM
Sorry, I upgraded and still cannot reproduce this problem.

Can you compile a.c, and attach the objects and a.out to this issue?

Susi Lehtola added a comment - 01/Aug/11 09:52 AM
a.o and a.out.

Anders Magnusson added a comment - 19/Apr/14 05:27 PM
Just tried this on Fedora 20, with success:

localhost:/home/ragge >cat x.c
#include <stdio.h>
int main()
{
    printf("Hello\n");
    return 0;
}

localhost:/home/ragge >pcc x.c
localhost:/home/ragge >./a.out
Hello
localhost:/home/ragge >uname -a
Linux localhost.localdomain 3.13.10-200.fc20.x86_64 #1 SMP Mon Apr 14 20:34:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
localhost:/home/ragge >cat /etc/redhat-release
Fedora release 20 (Heisenbug)

Susi Lehtola added a comment - 19/Apr/14 06:06 PM
As I commented in bug #420, if you compile pcc and pcc-libs with GCC at the -O2 level, you will be able to reproduce the wrong return code.