B::CC generates wrong C code for same variable in different scope

2 views
Skip to first unread message

Heinz Knutzen

unread,
Aug 16, 2010, 8:06:54 AM8/16/10
to perl-c...@googlegroups.com
If B::CC is applied to this test program, the generated C code fails to
compile.

fail2.pl
=====
sub new {}
sub test {
{ my $x = 1; }
my $x = 2;
if ($x != 3) { 4; }
}
=====

$ perl -MO=CC,-ofail2.c fail2.pl
fail2.pl syntax OK
$ cc_harness -o fail2 fail2.c
cc -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe
-fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -I/usr/lib/perl/5.10/CORE -o fail2 fail2.c -Wl,-E
-fstack-protector -L/usr/local/lib -L/usr/lib/perl/5.10/CORE
/usr/lib/libperl.so.5.10.1 -ldl -lm -lpthread -lc -lcrypt
fail2.c: In function ‘perl_init_aaaa’:
fail2.c:234: warning: assignment from incompatible pointer type
fail2.c:290: warning: assignment from incompatible pointer type
fail2.c:319: warning: assignment from incompatible pointer type
fail2.c:331: warning: assignment from incompatible pointer type
fail2.c:340: warning: assignment from incompatible pointer type
fail2.c:370: warning: assignment from incompatible pointer type
fail2.c:379: warning: assignment from incompatible pointer type
fail2.c:387: warning: assignment from incompatible pointer type
fail2.c:459: warning: assignment from incompatible pointer type
fail2.c: In function ‘pp_sub_test’:
fail2.c:546: error: redeclaration of ‘d_x’ with no linkage
fail2.c:546: note: previous declaration of ‘d_x’ was here

Used versions:
- perl v5.10.1 (*) built for i486-linux-gnu-thread-mult
(from Ubuntu 10.04)
- B::C version 1.27

--
Heinz Knutzen

Reply all
Reply to author
Forward
0 new messages