Two of the new testcases introduced in r153552 fail on both powerpc-apple-darwin9 and x86_64-apple-darwin10... FAIL: g++.dg/lookup/extern-c-redecl3.C scan-assembler call[\\t ]+fork FAIL: g++.dg/lookup/extern-c-redecl4.C scan-assembler call[\\t ]+_Z4forkv
I guess it is going to fail on many more targets. One issue is that only some targets have call insn called that way, it can have many other names on other targets. Even on ix86/x86_64 it could be tail called and be it jmp fork instead of call fork. The second issue is that some targets put various prefixes before the symbol name, guess the most often used one is just an extra _ prefix. So, probably the test should be limited to ix86/x86_64, ensure it is not built with optimizations and accept extra optional _ before symbol name.
Yes, I'll limit the test to ix86/x86_64. Patch coming soon.
Subject: Re: g++.dg/lookup/extern-c-redecl[3,4] .C scan-assembler fails on darwin Does this patch qualify as obvious ? /bin/bash: call : commande introuvable diff --git a/gcc/testsuite/g++.dg/lookup/extern-c-redecl3.C b/gcc/testsuite/g++.dg/lookup/extern-c-redecl3.C index 00ff4a9..3f2fee2 100644 --- a/gcc/testsuite/g++.dg/lookup/extern-c-redecl3.C +++ b/gcc/testsuite/g++.dg/lookup/extern-c-redecl3.C @@ -1,8 +1,9 @@ // Contributed by Dodji Seketeli <dodji@redhat.com> // Origin: PR c++/41020 +// { dg-options "-O0" } // { dg-do compile } -// { dg-final { scan-assembler-not "call\[\t \]+_Z4forkv" } } -// { dg-final { scan-assembler "call\[\t \]+fork" } } +// { dg-final { scan-assembler-not "call\[\t \]+_?_Z4forkv" { target i?86-*-* x86_64-*-* } } } +// { dg-final { scan-assembler "call\[\t \]+_?fork" { target i?86-*-* x86_64-*-* } } } extern "C" int fork (void); diff --git a/gcc/testsuite/g++.dg/lookup/extern-c-redecl4.C b/gcc/testsuite/g++.dg/lookup/extern-c-redecl4.C index 9dfa54d..bbe625e 100644 --- a/gcc/testsuite/g++.dg/lookup/extern-c-redecl4.C +++ b/gcc/testsuite/g++.dg/lookup/extern-c-redecl4.C @@ -1,10 +1,9 @@ // Contributed by Dodji Seketeli <dodji@redhat.com> // Origin: PR c++/41020 -// Avoid the "-ansi -pedantic" option -// { dg-options "" } +// { dg-options "-O0" } // { dg-do compile } -// { dg-final { scan-assembler "call\[\t \]+_Z4forkv" } } +// { dg-final { scan-assembler "call\[\t \]+_?_Z4forkv" { target i?86-*-* x86_64-*-* } } } class frok {
On i686-apple-darwin9, with the patch I get: Running target unix Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target. Using /sw/share/dejagnu/config/unix.exp as generic interface file for target. Using /opt/gcc/gcc-4.5-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file. Running /opt/gcc/gcc-4.5-work/gcc/testsuite/g++.dg/dg.exp ... FAIL: g++.dg/lookup/extern-c-redecl4.C scan-assembler call[\t ]+_?_Z4forkv === g++ Summary for unix === # of expected passes 11 # of unexpected failures 1 Running target unix/-m64 Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target. Using /sw/share/dejagnu/config/unix.exp as generic interface file for target. Using /opt/gcc/gcc-4.5-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file. Running /opt/gcc/gcc-4.5-work/gcc/testsuite/g++.dg/dg.exp ... === g++ Summary for unix/-m64 === # of expected passes 12 === g++ Summary === # of expected passes 23 # of unexpected failures 1 /Volumes/MacBook/opt/gcc/i686-darwin/gcc/testsuite/g++/../../g++ version 4.5.0 20091028 (experimental) [trunk revision 153644p3d] (GCC) grepping the assembly file for ++.dg/lookup/extern-c-redecl4.C compiled with -m32, I see call L__Z4forkv$stub call LPC$1 The failure disappears with the following patch: --- ../_gcc_clean/gcc/testsuite/g++.dg/lookup/extern-c-redecl4.C 2009-10-26 17:19:09.000000000 +0100 +++ gcc/testsuite/g++.dg/lookup/extern-c-redecl4.C 2009-10-28 22:39:48.000000000 +0100 @@ -2,9 +2,9 @@ // Origin: PR c++/41020 // Avoid the "-ansi -pedantic" option -// { dg-options "" } +// { dg-options "-O0" } // { dg-do compile } -// { dg-final { scan-assembler "call\[\t \]+_Z4forkv" } } +// { dg-final { scan-assembler "call\[\t \]+L?_?_Z4forkv" { target i?86-*-* x86_64-*-* } } } class frok {
Subject: Re: g++.dg/lookup/extern-c-redecl[3,4] .C scan-assembler fails on darwin Thanks for testing. How about this one ? diff --git a/gcc/testsuite/g++.dg/lookup/extern-c-redecl3.C b/gcc/testsuite/g++.dg/lookup/extern-c-redecl3.C index 00ff4a9..117c6d1 100644 --- a/gcc/testsuite/g++.dg/lookup/extern-c-redecl3.C +++ b/gcc/testsuite/g++.dg/lookup/extern-c-redecl3.C @@ -1,8 +1,9 @@ // Contributed by Dodji Seketeli <dodji@redhat.com> // Origin: PR c++/41020 +// { dg-options "" } // { dg-do compile } -// { dg-final { scan-assembler-not "call\[\t \]+_Z4forkv" } } -// { dg-final { scan-assembler "call\[\t \]+fork" } } +// { dg-final { scan-assembler-not "call\[\t \]+.*?_Z4forkv" { target i?86-*-* x86_64-*-* } } } +// { dg-final { scan-assembler "call\[\t \]+_?fork" { target i?86-*-* x86_64-*-* } } } extern "C" int fork (void); diff --git a/gcc/testsuite/g++.dg/lookup/extern-c-redecl4.C b/gcc/testsuite/g++.dg/lookup/extern-c-redecl4.C index 9dfa54d..a4515fd 100644 --- a/gcc/testsuite/g++.dg/lookup/extern-c-redecl4.C +++ b/gcc/testsuite/g++.dg/lookup/extern-c-redecl4.C @@ -1,10 +1,9 @@ // Contributed by Dodji Seketeli <dodji@redhat.com> // Origin: PR c++/41020 -// Avoid the "-ansi -pedantic" option // { dg-options "" } // { dg-do compile } -// { dg-final { scan-assembler "call\[\t \]+_Z4forkv" } } +// { dg-final { scan-assembler "call\[\t \]+.*?_Z4forkv" { target i?86-*-* x86_64-*-* } } } class frok {
Without test the part '.*?' in the rerexps seems odd. Why not '.*' only? My practice of regexp taught me that '.*' is asking for trouble and, when possible, should be replaced by [^some pattern]*. Why not "call[^Z]*Z4forkv" (not regtested, but it works when grepping the assembly)?
Subject: Re: g++.dg/lookup/extern-c-redecl[3,4] .C scan-assembler fails on darwin > ------- Comment #6 from dominiq at lps dot ens dot fr 2009-10-29 14:36 ------- > Without test the part '.*?' in the rerexps seems odd. Why not '.*' only? The '.*?' is the non greedy form of '.*'. If I put '.*' only, then '.*foo' '.*' will match the foo coming after and that will not do what I want.
(In reply to comment #7) > The '.*?' is the non greedy form of '.*'. If I put '.*' only, then '.*foo' > '.*' will match the foo coming after and that will not do what I want. The nongreedy form will not prevent that. You should never use '.*' because '.' can match newline.
> The '.*?' is the non greedy form of '.*'. I have learnt regexps at a time when this was not available on all regexp engines, so I always forget such constructs. I think pr41890 is a duplicate of this one.
*** Bug 41890 has been marked as a duplicate of this bug. ***
Also fail on hppa*-*-hpux*.
Subject: Re: g++.dg/lookup/extern-c-redecl[3,4] .C scan-assembler fails on darwin Sorry for my late reply. Could you please test this patch on darwin ? Thanks. diff --git a/gcc/testsuite/g++.dg/lookup/extern-c-redecl3.C b/gcc/testsuite/g++.dg/lookup/extern-c-redecl3.C index 00ff4a9..56dcefa 100644 --- a/gcc/testsuite/g++.dg/lookup/extern-c-redecl3.C +++ b/gcc/testsuite/g++.dg/lookup/extern-c-redecl3.C @@ -1,8 +1,9 @@ // Contributed by Dodji Seketeli <dodji@redhat.com> // Origin: PR c++/41020 +// { dg-options "" } // { dg-do compile } -// { dg-final { scan-assembler-not "call\[\t \]+_Z4forkv" } } -// { dg-final { scan-assembler "call\[\t \]+fork" } } +// { dg-final { scan-assembler-not "call\[\t \]+\[^\$\]*?_Z4forkv" { target i?86-*-* x86_64-*-* } } } +// { dg-final { scan-assembler "call\[\t \]+_?fork" { target i?86-*-* x86_64-*-* } } } extern "C" int fork (void); diff --git a/gcc/testsuite/g++.dg/lookup/extern-c-redecl4.C b/gcc/testsuite/g++.dg/lookup/extern-c-redecl4.C index 9dfa54d..c385ea7 100644 --- a/gcc/testsuite/g++.dg/lookup/extern-c-redecl4.C +++ b/gcc/testsuite/g++.dg/lookup/extern-c-redecl4.C @@ -1,10 +1,9 @@ // Contributed by Dodji Seketeli <dodji@redhat.com> // Origin: PR c++/41020 -// Avoid the "-ansi -pedantic" option // { dg-options "" } // { dg-do compile } -// { dg-final { scan-assembler "call\[\t \]+_Z4forkv" } } +// { dg-final { scan-assembler "call\[\t \]+\[^\$\]*?_Z4forkv" { target i?86-*-* x86_64-*-* } } } class frok {
Running target unix Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target. Using /sw/share/dejagnu/config/unix.exp as generic interface file for target. Using /opt/gcc/gcc-4.5-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file. Running /opt/gcc/gcc-4.5-work/gcc/testsuite/g++.dg/dg.exp ... === g++ Summary for unix === # of expected passes 12 Running target unix/-m64 Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target. Using /sw/share/dejagnu/config/unix.exp as generic interface file for target. Using /opt/gcc/gcc-4.5-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file. Running /opt/gcc/gcc-4.5-work/gcc/testsuite/g++.dg/dg.exp ... > Could you please test this patch on darwin ? With the patch in comment#12 I get on i686-apple-darwin9: make -k check-g++ RUNTESTFLAGS="dg.exp=lookup/extern-c-redecl* --target_board=unix'{,-m64}'" ... Running target unix Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target. Using /sw/share/dejagnu/config/unix.exp as generic interface file for target. Using /opt/gcc/gcc-4.5-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file. Running /opt/gcc/gcc-4.5-work/gcc/testsuite/g++.dg/dg.exp ... === g++ Summary for unix === # of expected passes 12 Running target unix/-m64 Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target. Using /sw/share/dejagnu/config/unix.exp as generic interface file for target. Using /opt/gcc/gcc-4.5-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file. Running /opt/gcc/gcc-4.5-work/gcc/testsuite/g++.dg/dg.exp ... === g++ Summary for unix/-m64 === # of expected passes 12 === g++ Summary === # of expected passes 24 /Volumes/MacBook/opt/gcc/i686-darwin/gcc/testsuite/g++/../../g++ version 4.5.0 20091102 (experimental) [trunk revision 153817p1] (GCC)
Subject: Bug 41856 Author: dodji Date: Mon Nov 2 22:58:07 2009 New Revision: 153829 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153829 Log: Fix PR c++/41856 PR c++/41856 * g++.dg/lookup/extern-c-redecl3.C: Make the test x86 only. * g++.dg/lookup/extern-c-redecl4.C: Likewise. Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/lookup/extern-c-redecl3.C trunk/gcc/testsuite/g++.dg/lookup/extern-c-redecl4.C
Fixed in 4.5.
Subject: Bug 41856 Author: dodji Date: Tue Nov 3 13:46:46 2009 New Revision: 153851 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153851 Log: Fix PR c++/41856 PR c++/41856 * g++.dg/lookup/extern-c-redecl3.C: Make the test x86 only. * g++.dg/lookup/extern-c-redecl4.C: Likewise. Modified: branches/gcc-4_4-branch/gcc/testsuite/ChangeLog branches/gcc-4_4-branch/gcc/testsuite/g++.dg/lookup/extern-c-redecl3.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/lookup/extern-c-redecl4.C