James E Wilson wrote:
The testcase is not portable, as I pointed out in the PR. Trying this on an x86_64-linux system, I get 27 "excess errors" failures. All of them are error: cast from 'int*' to 'int' loses precision Using long works better than int, but is still not fool proof, as there are targets where longs are smaller than pointers. Maybe we can rely on something like ptrdiff_t?
Here's the testcase I installed. I also put it on mainline, as I couldn't see one that you'd installed.
nathan -- Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC [EMAIL PROTECTED] :: http://www.planetfall.pwp.blueyonder.co.uk
2005-04-04 Nathan Sidwell <[EMAIL PROTECTED]>
PR debug/20505 * g++.dg/debug/const2.C: New. Index: testsuite/g++.dg/debug/const2.C =================================================================== RCS file: testsuite/g++.dg/debug/const2.C diff -N testsuite/g++.dg/debug/const2.C *** /dev/null 1 Jan 1970 00:00:00 -0000 --- testsuite/g++.dg/debug/const2.C 4 Apr 2005 09:29:12 -0000 *************** *** 0 **** --- 1,15 ---- + // Copyright (C) 2005 Free Software Foundation, Inc. + // Contributed by Nathan Sidwell 1 Apr 2005 <[EMAIL PROTECTED]> + + // { dg-options "-ggdb2" } + // Origin: ivan <[EMAIL PROTECTED]> + // [EMAIL PROTECTED] + // Bug 20505: ICE with -ggdb2 + + struct b + { + static const int d; + virtual bool IsEmpty() const=0; + int e,c; + }; + const int b::d = ((__SIZE_TYPE__)(&((b*)1)->c) - 1);