public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Need help creating a small test case for g++ 4.0.0 bug
@ 2005-08-03 16:31 Volker Reichelt
  2005-08-04 15:15 ` Paul C. Leopardi
  0 siblings, 1 reply; 10+ messages in thread
From: Volker Reichelt @ 2005-08-03 16:31 UTC (permalink / raw)
  To: leopardi; +Cc: gcc

Paul Leopardi wrote:

> I have now downloaded, bootstapped and installed gcc 4.0.1. The bug in g++ 
> optimization is still there. I've made an attempt to follow the instructions 
> on minimizing test cases and have so far accomplished:
> wc of old preprocessed source:
>   99412  260586 2965538 peg01.ii
> wc of new preprocessed source:
>   69309  241979 2668391 peg01.ii
> As you can see, this is not much of a reduction. The bug I'm seeing keeps 
> disappearing as I try to reduce the source code. It seems to be a subtle 
> interaction between the Barton-Nackman trick, Boost uBLAS, GNU hash_map and 
> the g++ flags -fstrict-aliasing and -finline-functions. If I try to eliminate 
> any of these, the bug disappears. 

You might want to try a recent snapshot of gcc 4.0.2, first.
Two aliasing bugs got fixed after the 4.0.1 release:

http://gcc.gnu.org/PR22591
http://gcc.gnu.org/PR23192

The first even caused std::list::swap to be miscompiled.

Regards,
Volker


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Need help creating a small test case for g++ 4.0.0 bug
  2005-08-03 16:31 Need help creating a small test case for g++ 4.0.0 bug Volker Reichelt
@ 2005-08-04 15:15 ` Paul C. Leopardi
  0 siblings, 0 replies; 10+ messages in thread
From: Paul C. Leopardi @ 2005-08-04 15:15 UTC (permalink / raw)
  To: gcc

Hi Volker,
On Thu, 4 Aug 2005 02:31 am, Volker Reichelt wrote:
> You might want to try a recent snapshot of gcc 4.0.2, first.
> Two aliasing bugs got fixed after the 4.0.1 release:
>
> http://gcc.gnu.org/PR22591
> http://gcc.gnu.org/PR23192
>
> The first even caused std::list::swap to be miscompiled.

I tried gcc-4.0-20050728. My bug still occurs.
Thanks, Paul Leopardi

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Need help creating a small test case for g++ 4.0.0 bug
  2005-08-03 16:16 Dan Kegel
  2005-08-03 16:19 ` Daniel Berlin
@ 2005-08-28 13:51 ` Paul C. Leopardi
  1 sibling, 0 replies; 10+ messages in thread
From: Paul C. Leopardi @ 2005-08-28 13:51 UTC (permalink / raw)
  To: gcc

Hi Dan,
Reply below.
Best regards
On Thu, 4 Aug 2005 02:05, Dan Kegel wrote:
> "Paul C. Leopardi" <leopardi@bigpond.net.au> wrote:
>  > So I seem to be left with a large ( >2.5MB ) preprocessed source file.
>  > Should I try to report the bug using this large file as a test case?
>
> Sure.  But you might want to try using an automated tool
> to reduce the test case first.  There's one called delta
> (or maybe there are several by that name, I'm not sure)
> that can do it.  I haven't tried them myself yet, but see:
>
> Original implementation:
> http://www.st.cs.uni-sb.de/dd/
>   
> http://programming.newsforge.com/article.pl?sid=05/06/30/1549248&from=rss
> http://www.stanford.edu/class/cs295/asgns/asgn1/asgn.pdf
> 2nd implementation?:
> http://www.cs.berkeley.edu/~dsw/

I used Daniel S. Wilkerson's delta from http://www.cs.berkeley.edu/~dsw/ and 
succeeded in reducing my test case enough to file bug 23599.

[4.0 Regression] Flag -fstrict-aliasing corrupts iterators
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23599

Thanks!

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Need help creating a small test case for g++ 4.0.0 bug
  2005-08-03 16:16 Dan Kegel
@ 2005-08-03 16:19 ` Daniel Berlin
  2005-08-28 13:51 ` Paul C. Leopardi
  1 sibling, 0 replies; 10+ messages in thread
From: Daniel Berlin @ 2005-08-03 16:19 UTC (permalink / raw)
  To: Dan Kegel; +Cc: GCC Mailing List, leopardi

> 2nd implementation?:
> http://www.cs.berkeley.edu/~dsw/

This is what we all use, AFAIK :)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Need help creating a small test case for g++ 4.0.0 bug
@ 2005-08-03 16:16 Dan Kegel
  2005-08-03 16:19 ` Daniel Berlin
  2005-08-28 13:51 ` Paul C. Leopardi
  0 siblings, 2 replies; 10+ messages in thread
From: Dan Kegel @ 2005-08-03 16:16 UTC (permalink / raw)
  To: GCC Mailing List, leopardi

"Paul C. Leopardi" <leopardi@bigpond.net.au> wrote:
 > So I seem to be left with a large ( >2.5MB ) preprocessed source file. Should
 > I try to report the bug using this large file as a test case?

Sure.  But you might want to try using an automated tool
to reduce the test case first.  There's one called delta
(or maybe there are several by that name, I'm not sure)
that can do it.  I haven't tried them myself yet, but see:

Original implementation:
http://www.st.cs.uni-sb.de/dd/
   http://programming.newsforge.com/article.pl?sid=05/06/30/1549248&from=rss
   http://www.stanford.edu/class/cs295/asgns/asgn1/asgn.pdf
2nd implementation?:
http://www.cs.berkeley.edu/~dsw/

-- 
Trying to get a job as a c++ developer?  See http://kegel.com/academy/getting-hired.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Need help creating a small test case for g++ 4.0.0 bug
  2005-05-16 17:50 ` Janis Johnson
@ 2005-08-03 15:18   ` Paul C. Leopardi
  0 siblings, 0 replies; 10+ messages in thread
From: Paul C. Leopardi @ 2005-08-03 15:18 UTC (permalink / raw)
  To: gcc

Hi Janis,
A belated reply to your message is below.
Best regards, Paul Leopardi

On Tue, 17 May 2005 03:23 am, Janis Johnson wrote:
> On Sat, May 14, 2005 at 12:16:54PM +1000, Paul C. Leopardi wrote:
> > Hi all,
> > I originally posted these messages to gcc-help, but had no reply, so I am
> > re-posting links to them here.
> >
> > I think I have found a bug in g++ 4.0.0, but need help in reporting it.
> > Maintainers like their bug reports to include short test cases, but I
> > don't know how to generate a short test case involving inlining. I
> > discovered the original problem by compiling GluCat (
> > http://glucat.sf.net ) and the preprocessor output from a short GluCat
> > test program contains over 66 000 lines of libstdc++, uBLAS and Glucat
> > code.
> >
> > Can anyone help, or should I just file a bug report using the huge test
> > case?
>
> The information in http://gcc.gnu.org/bugs/minimize.html might help.

I have now downloaded, bootstapped and installed gcc 4.0.1. The bug in g++ 
optimization is still there. I've made an attempt to follow the instructions 
on minimizing test cases and have so far accomplished:
wc of old preprocessed source:
  99412  260586 2965538 peg01.ii
wc of new preprocessed source:
  69309  241979 2668391 peg01.ii
As you can see, this is not much of a reduction. The bug I'm seeing keeps 
disappearing as I try to reduce the source code. It seems to be a subtle 
interaction between the Barton-Nackman trick, Boost uBLAS, GNU hash_map and 
the g++ flags -fstrict-aliasing and -finline-functions. If I try to eliminate 
any of these, the bug disappears. 
[ See http://en.wikipedia.org/wiki/Barton-Nackman ]

So I seem to be left with a large ( >2.5MB ) preprocessed source file. Should 
I try to report the bug using this large file as a test case? Or maybe I 
could get one of the gcc developers interested in using GluCat as a test bed 
for detecting bugs in g++ ? 

I am planning to release GluCat 0.1.9 fairly soon in any case, using g++ -O3 
-fno-strict-aliasing as a workaround. Since GluCat is a template library, the 
compiler flags are only used to build test programs, and as a guideline to 
users of the library. So the bug is not holding up GluCat. 

It's just that I'd like to see how a nightmare corner case bug like this gets 
fixed, and I'd like to contribute something to that fix, even though I don't 
know enough about gcc internals to provide a patch.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Need help creating a small test case for g++ 4.0.0 bug
  2005-05-14  6:28 Paul C. Leopardi
  2005-05-14  9:04 ` Andrew Pinski
@ 2005-05-16 17:50 ` Janis Johnson
  2005-08-03 15:18   ` Paul C. Leopardi
  1 sibling, 1 reply; 10+ messages in thread
From: Janis Johnson @ 2005-05-16 17:50 UTC (permalink / raw)
  To: paul.leopardi; +Cc: gcc

On Sat, May 14, 2005 at 12:16:54PM +1000, Paul C. Leopardi wrote:
> Hi all,
> I originally posted these messages to gcc-help, but had no reply, so I am 
> re-posting links to them here. 
> 
> I think I have found a bug in g++ 4.0.0, but need help in reporting it. 
> Maintainers like their bug reports to include short test cases, but I don't 
> know how to generate a short test case involving inlining. I discovered the 
> original problem by compiling GluCat ( http://glucat.sf.net ) and the 
> preprocessor output from a short GluCat test program contains over 66 000 
> lines of libstdc++, uBLAS and Glucat code.
> 
> Can anyone help, or should I just file a bug report using the huge test case?

The information in http://gcc.gnu.org/bugs/minimize.html might help.

Janis

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Need help creating a small test case for g++ 4.0.0 bug
  2005-05-14  9:04 ` Andrew Pinski
@ 2005-05-14  9:59   ` Paul C. Leopardi
  0 siblings, 0 replies; 10+ messages in thread
From: Paul C. Leopardi @ 2005-05-14  9:59 UTC (permalink / raw)
  To: gcc

Andrew,
Thanks for reminding me about this. I'll need to take a good look at this. 

The effect of the workaround is to change any instance of _GLUCAT_PRIVATE to 
public. This does not affect the validity or otherwise of the g++ bug I'm 
currently trying to report.

I wrote GluCat at a time when earlier versions of ICC and gcc were not as 
compliant with the C++ standard. I'll have to take the current versions of 
ICC and gcc as correct, and change the code.
Best regards, Paul Leopardi
 
On Sat, 14 May 2005 02:03 pm, Andrew Pinski wrote:
> On May 13, 2005, at 10:16 PM, Paul C. Leopardi wrote:
> > +//***************************** workaround for ICC, G++ 3.3+, G++ 4.0+
>
> Why do you need this work around?  Why has this not been filed or really
> fixed in their sources?
>
> -- Pinski

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Need help creating a small test case for g++ 4.0.0 bug
  2005-05-14  6:28 Paul C. Leopardi
@ 2005-05-14  9:04 ` Andrew Pinski
  2005-05-14  9:59   ` Paul C. Leopardi
  2005-05-16 17:50 ` Janis Johnson
  1 sibling, 1 reply; 10+ messages in thread
From: Andrew Pinski @ 2005-05-14  9:04 UTC (permalink / raw)
  To: paul.leopardi; +Cc: gcc


On May 13, 2005, at 10:16 PM, Paul C. Leopardi wrote:

> +//***************************** workaround for ICC, G++ 3.3+, G++ 4.0+
>

Why do you need this work around?  Why has this not been filed or really
fixed in their sources?

-- Pinski

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Need help creating a small test case for g++ 4.0.0 bug
@ 2005-05-14  6:28 Paul C. Leopardi
  2005-05-14  9:04 ` Andrew Pinski
  2005-05-16 17:50 ` Janis Johnson
  0 siblings, 2 replies; 10+ messages in thread
From: Paul C. Leopardi @ 2005-05-14  6:28 UTC (permalink / raw)
  To: gcc

Hi all,
I originally posted these messages to gcc-help, but had no reply, so I am 
re-posting links to them here. 

I think I have found a bug in g++ 4.0.0, but need help in reporting it. 
Maintainers like their bug reports to include short test cases, but I don't 
know how to generate a short test case involving inlining. I discovered the 
original problem by compiling GluCat ( http://glucat.sf.net ) and the 
preprocessor output from a short GluCat test program contains over 66 000 
lines of libstdc++, uBLAS and Glucat code.

Can anyone help, or should I just file a bug report using the huge test case?

The original posts were:

g++ 4.0.0: hash_map hangs when compiled with -O3 on AMD64
http://gcc.gnu.org/ml/gcc-help/2005-05/msg00030.html

Re: g++ 4.0.0: hash_map hangs when compiled with -O3 on AMD64
http://gcc.gnu.org/ml/gcc-help/2005-05/msg00087.html

I am particularly interested in the interference between hash_map, 
-fstrict-aliasing  and -finline-functions, and I wonder if it happens on 
other architectures, or only on AMD64.

Best regards, Paul Leopardi

PS.
If you try compling the current GluCat 0.1.8 using g++ 4.0.0, you will need 
the following patch.

diff 
-u /home/leopardi/src/glucat/glucat-0.1.8/glucat/portability.h ./portability.h
--- /home/leopardi/src/glucat/glucat-0.1.8/glucat/portability.h 2004-05-10 
21:28:42.000000000 +1000
+++ ./portability.h     2005-05-01 22:11:22.000000000 +1000
@@ -28,15 +28,15 @@
 #define ios_base ios // scope is different for standard C++
 #endif

-//***************************** workaround for ICC and G++ 3.3+
-#if defined (__ICL) || defined (__ICC) || defined (__GNUG__) && (__GNUC__ >= 
3) && (__GNUC_MINOR__ >= 3)
+//***************************** workaround for ICC, G++ 3.3+, G++ 4.0+
+#if defined (__ICL) || defined (__ICC) || defined (__GNUG__) && ((__GNUC__ == 
3) && (__GNUC_MINOR__ >= 3) || (__GNUC__ == 4))
 #define _GLUCAT_PRIVATE public
 #else
 #define _GLUCAT_PRIVATE private
 #endif

 //***************************** workaround for G++ 3.2 typename bug
-#if defined (__GNUG__) && (__GNUC__ >= 3) && (__GNUC_MINOR__ <= 2)
+#if defined (__GNUG__) && (__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)
 #define _GLUCAT_USE_STRUCT_NAME(T)
 #else
 #define _GLUCAT_USE_STRUCT_NAME(T) T::

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2005-08-28  3:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-03 16:31 Need help creating a small test case for g++ 4.0.0 bug Volker Reichelt
2005-08-04 15:15 ` Paul C. Leopardi
  -- strict thread matches above, loose matches on Subject: below --
2005-08-03 16:16 Dan Kegel
2005-08-03 16:19 ` Daniel Berlin
2005-08-28 13:51 ` Paul C. Leopardi
2005-05-14  6:28 Paul C. Leopardi
2005-05-14  9:04 ` Andrew Pinski
2005-05-14  9:59   ` Paul C. Leopardi
2005-05-16 17:50 ` Janis Johnson
2005-08-03 15:18   ` Paul C. Leopardi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).