Subject: gcc 3.3.6 sparc regression
To: None <tech-toolchain@NetBSD.org>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: tech-toolchain
Date: 06/12/2006 07:32:29
Gcc 3.3.6 introduced an interesting regression for sparc.

Havard Eidnes reported that sparc's bootxx became too big to fit when
compiled with the new gcc.  Compared to the pre-3.3.6 import bootxx
contained __muldi3 and .umul (pulled in by the former) which was weird
as __muldi3 is never actually called.

I tracked this bug down to the following minimal testcase:

  static inline int test(int a) { return a * 1000000000; }
  int main() { return 0; }

When compiled with gcc 3.3.6 the .S file contains orphan
".global .umul" both with default -O2 and -O0.  With -O3 the refernce
goes away.

bootxx reference to __muldi3 is triggered by a similar static inline
bintime2timespec() in <sys.time.h>

as(1) produces an undefined symbol references for such orphan .global,
and so linker pulls in the symbol if the program is linked statically.

In-tree gcc4 (4.1.1+) doesn't have this bug.

The bug seems to be sparc specific.  At least this test case compiles
ok with arm, sh3 and i386 cross-compilers I have handy.

SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://snark.ptc.spbu.ru/~uwe/          |       Ist zu Grunde gehen