This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH COMMITTED: Fix bug building complex C++ code
Tom Tromey <tromey@redhat.com> writes:
> >>>>> "Ian" == Ian Lance Taylor <iant@google.com> writes:
>
> Ian> Sometimes policies have to yield to reality. But of course Tom may be
> Ian> free to reduce and the test case himself.
>
> If someone wants to reduce it, I will mail the .ii file. It is 2.3M.
> Essentially it is the entire old gcjx front end in a single file.
Tom sent me the file, and I reduced it to a test case which fails
before my patch and succeeds after. Oddly, the test case requires
using a template; I would guess that TREE_OVERFLOW is being set for a
template constant but not for a non-template constant. That is
probably a minor bug in itself, but not one I plan to look into.
Test case committed to mainline.
Ian
2007-05-23 Ian Lance Taylor <iant@google.com>
* g++.dg/other/vrp1.C: New test.
Index: g++.dg/other/vrp1.C
===================================================================
--- g++.dg/other/vrp1.C (revision 0)
+++ g++.dg/other/vrp1.C (revision 0)
@@ -0,0 +1,12 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+// This caused a crash in VRP because TREE_OVERFLOW was set for MIN.
+
+template<long long MIN>
+long long mod (long long l, long long r)
+{
+ if (l == MIN && r == -1)
+ return 0LL;
+ return l % r;
+}
+template long long mod<-0x8000000000000000LL> (long long, long long);