The attached source files demonstrate a bug with gcc-2.95.1 and gcc 3.2
The bug is that if you compile one file with no special options
(or with just `-mflat', or just `-fpic', but not both), and
another file with `-mflat -fpic', and link the two together, then in
the file compiled with no special options it treats register l7 as
a callee-save register, but in the file compiled with `-mflat -fpic'
it clobbers register l7 without saving it.
The attached program should output "1,2,3,4,5,6,7,8,9,10",
but on my system the program gets a Segmentation Fault instead.
Created attachment 4898 [details]
test case part 1
Created attachment 4899 [details]
test case part 2: x.c
Created attachment 4900 [details]
test case part 3: y.c
Can you try 3.3.1 as 3.2 is old?
Confirmed with all GCC versions I tested.
Subject: Bug 12538
Module name: gcc
Changes by: email@example.com 2003-10-13 09:57:53
gcc : ChangeLog
* config/sparc/sparc.c (MUST_SAVE_REGISTER): Delete.
(sparc_flat_must_save_register_p): New function to decide whether
a register must be saved/restored in the function prologue/epilogue.
(sparc_flat_compute_frame_size): Use it instead of MUST_SAVE_REGISTER.
Fixed for GCC 3.4, see http://gcc.gnu.org/ml/gcc-patches/2003-10/msg00889.html