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]

PR other/54324: allow bootstrapping with older compilers


Hi Richard.

Your last patch for this PR suggested we verify our assumptions wrt a least common C++ compiler to build trunk with. Since I already had the offended system at hand (Red Hat Linux 8.0), I decided to investigate a bit further.

g++ 3.4 builds trunk just fine, but anything prior to this chokes on a variety of inputs. The patch below fixes them all, and gets 4.8 to bootstrap with a GCC 3.2 system.

I don't know how much of this is a fool's errand, and if we want to commit to supporting < GCC 3.4, but your patch suggested c++98, and GCC 3.2 claims such.

The fixed issues are as follows:

1. Older G++ cannot understand attributes among arguments:

int foo(int bar __attribute__ ((__unused__)))

   It looks like we already have ARG_UNUSED for this precise problem,
   and it is already predicated on !__cplusplus || GCC_VERSION >= 3004.
   However, we've deviated from using ARG_UNUSED
   throughout the compiler, and I spent hours changing
   ATTRIBUTE_UNUSED into ARG_UNUSED until I gave up.  It's EVERYWHERE
   in the compiler-- all the way into our gen*.c files.  It seemed a lot
   simpler just changing the definition of ATTRIBUTE_UNUSED.

Perhaps we could even deprecate ARG_UNUSED?

2. gcov-io.c uses __builtin_popcountll and __builtin_clzll.  Older
   GCC's do not have this.  For that matter, how does this even work on
   non-GCC systems?

   I have abstracted the non built-in versions we have for these in
   hwint.c, which seem written for older GCC's and non GCC's.

   I am not a huge fan of the new include file, but I really didn't
   want to duplicate code.  I'm open to suggestions.

3. Derived classes that include a union template die miserably on g++
   3.2.  Thankfully, this works:

	-struct ssa_name_var_hash : typed_noop_remove <union tree_node>
	+struct ssa_name_var_hash : typed_noop_remove <tree_node>

4. Type checking as part of a `for' initializer segfaults on g++ 3.2:

for (type = TYPE_MAIN_VARIANT (blah); ....)

   The only reasonable thing I could think of, was disabling the tree
   checking code for older compilers.

I really don't want to spend much more time on this, but at the same time, I don't want to throw away a day's work, especially if it could conceivably help us with (older) non-GCC bootstrap compilers.

The attached patch bootstraps trunk on GCC 3.2 on a Red Hat Linux 8.0 system (i686) configured with:

blah/configure --enable-languages=c,c++ --disable-libsanitizer

libsanitizer seems to be a moving target and it currently has issues with the RHL8.0 header files (earlier today it had other problems :)).

What are your thoughts on this?

Attachment: curr
Description: Text document


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