[Bug c++/41856] g++.dg/lookup/extern-c-redecl[3,4] .C scan-assembler fails on darwin

2009-10-31 Thread dominiq at lps dot ens dot fr


--- Comment #9 from dominiq at lps dot ens dot fr  2009-10-31 17:13 ---
 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.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41856



[Bug c++/41856] g++.dg/lookup/extern-c-redecl[3,4] .C scan-assembler fails on darwin

2009-10-31 Thread hjl dot tools at gmail dot com


--- Comment #10 from hjl dot tools at gmail dot com  2009-10-31 17:31 
---
*** Bug 41890 has been marked as a duplicate of this bug. ***


-- 

hjl dot tools at gmail dot com changed:

   What|Removed |Added

 CC||hjl dot tools at gmail dot
   ||com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41856



[Bug c++/41856] g++.dg/lookup/extern-c-redecl[3,4] .C scan-assembler fails on darwin

2009-10-29 Thread dodji at seketeli dot org


--- Comment #5 from dodji at seketeli dot org  2009-10-29 07:22 ---
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 do...@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 do...@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
 {


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41856



[Bug c++/41856] g++.dg/lookup/extern-c-redecl[3,4] .C scan-assembler fails on darwin

2009-10-29 Thread dominiq at lps dot ens dot fr


--- 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?  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)?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41856



[Bug c++/41856] g++.dg/lookup/extern-c-redecl[3,4] .C scan-assembler fails on darwin

2009-10-29 Thread dodji at seketeli dot org


--- Comment #7 from dodji at seketeli dot org  2009-10-29 17:09 ---
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.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41856



[Bug c++/41856] g++.dg/lookup/extern-c-redecl[3,4] .C scan-assembler fails on darwin

2009-10-29 Thread schwab at linux-m68k dot org


--- Comment #8 from schwab at linux-m68k dot org  2009-10-29 17:29 ---
(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.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41856



[Bug c++/41856] g++.dg/lookup/extern-c-redecl[3,4] .C scan-assembler fails on darwin

2009-10-28 Thread jakub at gcc dot gnu dot org


--- Comment #1 from jakub at gcc dot gnu dot org  2009-10-28 14:00 ---
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.


-- 

jakub at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||dodji at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41856



[Bug c++/41856] g++.dg/lookup/extern-c-redecl[3,4] .C scan-assembler fails on darwin

2009-10-28 Thread dodji at gcc dot gnu dot org


--- Comment #2 from dodji at gcc dot gnu dot org  2009-10-28 15:38 ---
Yes, I'll limit the test to ix86/x86_64. Patch coming soon.


-- 

dodji at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |dodji at gcc dot gnu dot org
   |dot org |
 Status|UNCONFIRMED |ASSIGNED
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2009-10-28 15:38:45
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41856



[Bug c++/41856] g++.dg/lookup/extern-c-redecl[3,4] .C scan-assembler fails on darwin

2009-10-28 Thread dodji at seketeli dot org


--- Comment #3 from dodji at seketeli dot org  2009-10-28 20:53 ---
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 do...@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 do...@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
 {


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41856



[Bug c++/41856] g++.dg/lookup/extern-c-redecl[3,4] .C scan-assembler fails on darwin

2009-10-28 Thread dominiq at lps dot ens dot fr


--- Comment #4 from dominiq at lps dot ens dot fr  2009-10-28 21:41 ---
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 passes11
# of unexpected failures1
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 passes12

=== g++ Summary ===

# of expected passes23
# of unexpected failures1
/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

callL__Z4forkv$stub
callLPC$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.0 +0100
+++ gcc/testsuite/g++.dg/lookup/extern-c-redecl4.C  2009-10-28
22:39:48.0 +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
 {


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41856