This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: don't assume pointer cast to unsigned long is a valid initializer


Mark Mitchell <mark at codesourcery dot com> writes:

> On Fri, 2003-02-28 at 14:12, Geoff Keating wrote:
> > Alexandre Oliva <aoliva at redhat dot com> writes:
> > 
> > > +++ gcc/testsuite/gcc.c-torture/compile/20010327-1.c 28 Feb 2003 08:12:12 -0000
> > > @@ -1,2 +1,6 @@
> > >  extern void _text;
> > > -static unsigned long x = (unsigned long) &_text - 0x10000000L - 1;
> > > +/* We use __SIZE_TYPE__ here because it's as wide as a pointer, so we
> > > +   know we won't have a non-constant because of extension or
> > > +   truncation of the pointer to fit.  */
> > > +static __SIZE_TYPE__ x
> > > +  = (__SIZE_TYPE__) &_text - (__SIZE_TYPE__) 0x10000000L - 1;
> > 
> > Not OK.  See the CVS log and mailing list archives for why.
> > Please back out your change.
> 
> Would you be so kind as to add a comment in the code containing whatever
> is in the mailing list archives and CVS logs?  I would have tended to
> approve that patch as well, just looking at it.

The most fundamental reason is that Alexandre's patch changes this testcase.
Changing testcases without changing their name is strongly discouraged.

Other reasons are that Alexandre's patch makes the testcase an exact
duplicate of 20011114-1.c; and that we've had almost this exact patch
proposed before, committed, and reverted by me for the first reason above.

I believe that there are even more reasons why this testcase should
stay the way it is, but I'll leave Alexandre (if he's still
interested) to do the research in the mailing list archives to work
out where the testcase came from and why it is the way it is.

In the meantime, however, I will apply this patch.

*** codingconventions.html.~1.19.~	Sat Feb 15 21:43:22 2003
--- codingconventions.html	Fri Feb 28 17:56:34 2003
***************
*** 132,137 ****
--- 132,144 ----
  href="http://gcc.gnu.org/ml/gcc/2000-01/msg00593.html";>copyright
  guidelines</a> on what can be included in the testsuite.</p>
  
+ <p>If a testcase itself is incorrect, but there's a possibility that an
+ improved testcase might fail on some platform where the incorrect
+ testcase passed, the old testcase should be removed and a new testcase
+ (with a different name) should be added.  This helps automated
+ regression-checkers distinguish a true regression from an improvement
+ to the test suite.</p>
+ 
  
  <h2>Miscellaneous Conventions</h2>
  
-- 
- Geoffrey Keating <geoffk at geoffk dot org>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]