GCC 4.6 related common package rebuild failures (was Re: mass rebuild status)

Jakub Jelinek jakub at redhat.com
Wed Feb 9 16:57:25 UTC 2011


Hi!

On Tue, Feb 08, 2011 at 06:23:57PM -0600, Dennis Gilmore wrote:
> so the mass rebuild is 24 hours in we have completed ~45% of the builds and 
> are at 365 packages failed to build the total number of builds in the mass 
> rebuild is 10404 we are churning along nicely. i expect to complete the first 
> pass sometime in the next 24 hours. so far i think its going pretty well
> 
> some web pages to look at http://ausil.fedorapeople.org/rebuild.html and 
> http://ausil.fedorapeople.org/failed.html these 2 pages are updated ~ every 10 
> minutes. Please drop into #fedora-devel on freenode if you have any questions.

I went through the failed.html list from shortly after you mailed this,
looking for errors related to GCC 4.6 (and sometimes even 4.5).

Here are some common errors.  Please try to fix the issues rather than
adding workaround flags like -fpermissive, -Wno-unused-but-set-variable etc.
Benjamin, do you plan to write http://gcc.gnu.org/gcc-4.6/porting_to.html?
This could serve as partial source for that page.

-Werror=unused-but-set-variable
	void fn (void)
	{
	  int foo;
	  foo = bar ();
	  /* foo is never used.  */
	}
	This is a new warning, which warns about variables that are only
	ever set, but never otherwise used.  Usually such variables useless
	and often even the value assigned to them is computed needlessly,
	sometimes expensively.  In such cases you should just drop the
	vars and initializers.  Sometimes functions called during the
	initialization have important side-effects for the program,
	so you really need to read the source.  So sometimes you want
	to drop the unuse variables, but keep some function calls from
	their initialization in the code.  In some cases (often from
	macro expansion) you just want to keep such unused variables
	around.  You can in that case just cast them to void,
	or add __attribute__((__unused__)) to them.  As this is just
	a warning, it is usually just a nice to fix thing, but for packages
	that are compiled with -Werror it is a must fix.

STL headers not including <cstddef> any longer
	If you see errors like

	'ptrdiff_t' does not name a type
	'size_t' does not name a type
	'NULL' was not declared in this scope
	'size_t' has not been declared
	'offsetof' was not declared in this scope
	there are no arguments to 'offsetof' that depend on a template parameter, so a declaration of 'offsetof' must be available

	or warnings like

	perhaps the 'offsetof' macro was used incorrectly

	then most likely you have C++ code that includes some
	STL headers and relied on them bringing in <stddef.h>
	and is using ::ptrdiff_t, ::size_t, offsetof or NULL
	macros.  The STL headers now just declare std::ptrdiff_t
	and std::size_t itself when needed, and no longer bring
	in <stddef.h>, so if you use the global namespace types
	from stddef.h or offsetof/NULL, just include <cstddef>
	explicitly.

uninitialized const
	struct A { int a; A (); };
	struct B : public A { };
	const B b;

	now gets an error:
	error: uninitialized const ‘b’ [-fpermissive]
	note: ‘const struct B’ has no user-provided default constructor

	This is related to http://gcc.gnu.org/PR43890, B above doesn't
	have a user provided default ctor, so either an initializer
	needs to be provided, or the default ctor needs to be added.

reference ‘...’ cannot be declared ‘mutable’
	struct A { mutable int &p; int q; A () : p(q) {} };

	http://gcc.gnu.org/PR33558
	Just remove mutable keyword from references.

taking address of temporary
	struct S { S (); int i; };
	void bar (S *);
	void foo () { bar (&S ()); }

	http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164704
	http://gcc.gnu.org/ml/gcc-patches/2010-09/msg02144.html

	This used to be just a warning, now it is an error (unless
	-fpermissive).  Please don't add -fpermissive, instead just
	add a variable and pass address of the variable if at all
	possible.

duplicate member
	struct A { int *a; union { struct { int *a; }; }; };

	used to be diagnosed just by C++ FE, now since
	http://gcc.gnu.org/PR4784 it is diagnosed also by C.
	Because of the anonymous unions/structs there is ambiguity
	about what .a actually refers to, one of the fields needs
	to be renamed.

unrecognized option '-combine'
	The -combine option has been removed, it has been very buggy and has
	been superceeded by -flto.  Either drop it, or build with -flto.

-export-dynamic
	Some packages are passing -export-dynamic to gcc/g++ drivers,
	when they should be using -Wl,-export-dynamic or -rdynamic or
	-Wl,-E.  See http://gcc.gnu.org/PR47390, it is unclear yet
	whether gcc 4.6 will handle it for backwards compatibility when
	it has never been documented it would work this way.

--export-dynamic
--no-undefined
	gcc/g++ drivers in 4.4/4.5 didn't accept these options either,
	so I guess this is some libtool issue.  Some packages are also
	using -Wl, --export-dynamic (note the space in between -Wl,
	and the option).  That's wrong, but didn't work previously either.

cannot call constructor directly
	struct A { A (); A (int); int i; };
	A::A (int x) { A::A (); i = x; }

	This used to be accepted in 4.4, but already 4.5 rejects it
	(so 4.5 porting_to.html material).  http://gcc.gnu.org/PR42415

storage size of '...' isn't constant
	void foo (void) { static char buffers[2][(int)(sizeof(int)*3.32)+3]; }

	This used to be accepted in C until 4.4, but isn't any longer,
	since floating point multiplication there makes it no longer
	a valid constant expression.  In this case just multiply by 4
	instead (but even sizeof(...)*3 +3 would work for "%llu" or "HEAD").
	Again, 4.5 porting_to.html material.

names the constructor, not the type
	struct S { S (); };
	void foo () { S::S s; }

	This used to be accepted until 4.4, but isn't any longer,
	::S should be dropped.  http://gcc.gnu.org/PR9050
	4.5 porting_to.html material.

internal compiler error
	If you see this, please do a build in local mock and file a
	bugreport with the attached /tmp/cc*.out file from the buildroot
	about which the gcc/g++ error talked about.  If none has been
	prepared and it is still reproduceable (shouldn't happen), then
	please preprocess it manually, verify it reproduces with the
	preprocessed file and file it.
	
GCC bugs:
	http://gcc.gnu.org/PR47662 - -fno-operator-names no longer works with STL
	http://gcc.gnu.org/PR47665 - ICE in trunc_int_for_mode on SSE2 code
	http://gcc.gnu.org/PR47666 - ICE in dfs_walk_once


	Jakub


More information about the devel mailing list