Bug 59496 - [4.9 Regression] Bootstrap fails on powerpc-apple-darwin9 after r205685
Summary: [4.9 Regression] Bootstrap fails on powerpc-apple-darwin9 after r205685
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.9.0
: P4 normal
Target Milestone: 4.9.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-13 14:52 UTC by Dominique d'Humieres
Modified: 2014-01-21 08:52 UTC (History)
4 users (show)

See Also:
Host: powerpc-apple-darwin9
Target: powerpc-apple-darwin9
Build: powerpc-apple-darwin9
Known to work:
Known to fail:
Last reconfirmed: 2013-12-13 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dominique d'Humieres 2013-12-13 14:52:32 UTC
Bootstrap fails on powerpc-apple-darwin9 after r205685 and is not fixed by r205705:

/opt/gcc/rel_build/./prev-gcc/xg++ -B/opt/gcc/rel_build/./prev-gcc/ -B/opt/gcc/gcc4.9r/powerpc-apple-darwin9.8.0/bin/ -nostdinc++ -B/opt/gcc/rel_build/prev-powerpc-apple-darwin9.8.0/libstdc++-v3/src/.libs -B/opt/gcc/rel_build/prev-powerpc-apple-darwin9.8.0/libstdc++-v3/libsupc++/.libs -I/opt/gcc/rel_build/prev-powerpc-apple-darwin9.8.0/libstdc++-v3/include/powerpc-apple-darwin9.8.0 -I/opt/gcc/rel_build/prev-powerpc-apple-darwin9.8.0/libstdc++-v3/include -I/opt/gcc/rel_work/libstdc++-v3/libsupc++ -L/opt/gcc/rel_build/prev-powerpc-apple-darwin9.8.0/libstdc++-v3/src/.libs -L/opt/gcc/rel_build/prev-powerpc-apple-darwin9.8.0/libstdc++-v3/libsupc++/.libs -c  -DIN_GCC_FRONTEND -DIN_GCC_FRONTEND -g -O2 -mdynamic-no-pic -gtoggle -DIN_GCC    -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror   -DHAVE_CONFIG_H -I. -Ic-family -I../../rel_work/gcc -I../../rel_work/gcc/c-family -I../../rel_work/gcc/../include -I./../intl -I../../rel_work/gcc/../libcpp/include -I/opt/mp/include  -I../../rel_work/gcc/../libdecnumber -I../../rel_work/gcc/../libdecnumber/dpd -I../libdecnumber -I../../rel_work/gcc/../libbacktrace -DCLOOG_INT_GMP  -I/opt/mp/include  -o c-family/c-common.o -MT c-family/c-common.o -MMD -MP -MF c-family/.deps/c-common.TPo ../../rel_work/gcc/c-family/c-common.c
../../rel_work/gcc/c-family/c-common.c: In function 'tree_node* c_sizeof_or_alignof_type(location_t, tree, bool, bool, int)':
../../rel_work/gcc/c-family/c-common.c:5009:9: error: unused variable 'field' [-Werror=unused-variable]
    tree field = build_decl (UNKNOWN_LOCATION, FIELD_DECL, NULL_TREE,
         ^
cc1plus: all warnings being treated as errors

The problem comes from the fact that ADJUST_FIELD_ALIGN is defined in gcc/config/rs6000/darwin.h as

#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED)     \
  (TARGET_ALIGN_NATURAL ? (COMPUTED)            \
   : (COMPUTED) == 128 ? 128                    \
   : MIN ((COMPUTED), 32))

and does not use FIELD, as seen in the preprocessed file

...
   tree field = build_decl_stat (((source_location) 0), FIELD_DECL, (tree) __null, type )
            ;
   field_align = ((global_options.x_rs6000_alignment_flags & 0x00000001) ? (field_align) : (field_align) == 128 ? 128 : (((field_align)) < (32) ? ((field_align)) : (32)));

   align = ((align) < (field_align) ? (align) : (field_align));
...

I have fixed the problem with the following patch:

--- gcc/c-family/c-common.c	2013-12-11 13:43:47.000000000 +0100
+++ ../work/gcc/c-family/c-common.c	2013-12-08 00:14:27.000000000 +0100

@@ -5002,7 +5006,7 @@ c_sizeof_or_alignof_type (location_t loc
 #endif
 	  unsigned int field_align = align;
 #ifdef ADJUST_FIELD_ALIGN
-	  tree field = build_decl (UNKNOWN_LOCATION, FIELD_DECL, NULL_TREE,
+	  tree __attribute__((unused)) field = build_decl (UNKNOWN_LOCATION, FIELD_DECL, NULL_TREE,
 				   type);
 	  field_align = ADJUST_FIELD_ALIGN (field, field_align);
 #endif

Yes I know, the line is too long and patches should go to gcc-patches. I'll do it if there is a consensus that it is the right fix.
Comment 1 Iain Sandoe 2013-12-13 14:59:26 UTC
from the point of view of powerpc-darwin, this is the right fix (it doesn't need to act on FIELD in this context).
Comment 2 Richard Biener 2013-12-19 15:43:11 UTC
darwin should simply add a dummy use of field, like via ((field), (...))
Comment 3 Iain Sandoe 2013-12-19 15:50:53 UTC
(In reply to Richard Biener from comment #2)
> darwin should simply add a dummy use of field, like via ((field), (...))

well, I thought of doing that, but it seems a kludge - is the target obliged to use the macro values?
Comment 4 Jakub Jelinek 2014-01-13 16:54:04 UTC
(In reply to Iain Sandoe from comment #3)
> (In reply to Richard Biener from comment #2)
> > darwin should simply add a dummy use of field, like via ((field), (...))
> 
> well, I thought of doing that, but it seems a kludge - is the target obliged
> to use the macro values?

Given that all other targets use it, I'd say yes in this case.
Comment 5 Jakub Jelinek 2014-01-13 16:56:52 UTC
Also, ppc*-darwin* isn't primary nor secondary target and the only one affected, downgrading to P4.
Comment 6 Dominique d'Humieres 2014-01-18 21:12:50 UTC
Patch posted at http://gcc.gnu.org/ml/gcc-patches/2014-01/msg00816.html.
Comment 7 Iain Sandoe 2014-01-20 11:20:55 UTC
Author: iains
Date: Mon Jan 20 11:20:24 2014
New Revision: 206802

URL: http://gcc.gnu.org/viewcvs?rev=206802&root=gcc&view=rev
Log:
gcc:

	PR bootstrap/59496
	* config/rs6000/darwin.h (ADJUST_FIELD_ALIGN): Fix unused variable
	warning.  Amend comment to reflect current functionality.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/darwin.h
Comment 8 Dominique d'Humieres 2014-01-21 08:52:04 UTC
Thanks for the fix. Closing.