Bug 68346 - [6 Regression] Bootstrap failure on i686-linux
Summary: [6 Regression] Bootstrap failure on i686-linux
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: 6.0
Assignee: Jason Merrill
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-14 09:12 UTC by Jakub Jelinek
Modified: 2016-01-07 23:03 UTC (History)
2 users (show)

See Also:
Host:
Target: aarch64
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-11-14 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2015-11-14 09:12:27 UTC
Most likely since the c++ delayed folding merge, but I admit I've bootstrapped trunk on i686-linux 8 days ago, so the window is larger, trunk no longer bootstraps on i686-linux:
../../gcc/gimple-fold.c: In function ‘bool gimple_fold_builtin_printf(gimple_stmt_iterator*, tree, tree, built_in_function)’:
../../gcc/gimple-fold.c:2621:30: error: self-comparison always evaluates to true [-Werror=tautological-compare]
        && (size_t) (int) len == len
                              ^~
This code is not new in there, but supposedly before that we either have not been folding the arguments for -Wtautological-compare, or not so aggressively.
I'd say it is quite common idiom to cast a variable to some other type and compare to itself, with the intent that if the type is the same, it is a no-op check, but if the type is narrower or has different signedness, it filters out some undesirable values.
Comment 1 Jakub Jelinek 2015-11-14 09:26:11 UTC
Note one even can't work around this warning through say:
&& (sizeof (int) >= sizeof (size_t) ? 1 : (size_t) (int) len == len)
Comment 2 Jason Merrill 2015-11-14 18:54:48 UTC
Author: jason
Date: Sat Nov 14 18:54:16 2015
New Revision: 230382

URL: https://gcc.gnu.org/viewcvs?rev=230382&root=gcc&view=rev
Log:
	PR bootstrap/68346
	* call.c (build_new_op_1): Don't fold arguments to
	warn_tautological_cmp.

Added:
    trunk/gcc/testsuite/g++.dg/warn/Wtautological-compare.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
Comment 3 Jason Merrill 2015-11-14 21:03:23 UTC
Fixed.
Comment 4 Andreas Schwab 2015-11-15 09:27:12 UTC
Still fails on aarch64 as of r230393.

../../gcc/builtins.c:1101:46: error: self-comparison always evaluates to false [-Werror=tautological-compare]
       if ((unsigned) PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM
                                              ^~
Comment 5 Jason Merrill 2015-11-17 18:17:06 UTC
Author: jason
Date: Tue Nov 17 18:16:35 2015
New Revision: 230471

URL: https://gcc.gnu.org/viewcvs?rev=230471&root=gcc&view=rev
Log:
	PR bootstrap/68346

	* c-common.c (warn_tautological_cmp): Fold before checking for
	constants.

Added:
    trunk/gcc/testsuite/g++.dg/warn/Wtautological-compare2.C
Modified:
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-common.c
Comment 6 Jason Merrill 2015-11-17 21:49:55 UTC
Author: jason
Date: Tue Nov 17 21:49:23 2015
New Revision: 230508

URL: https://gcc.gnu.org/viewcvs?rev=230508&root=gcc&view=rev
Log:
	PR bootstrap/68346

	* typeck.c (build_static_cast_1): Force a NOP when converting to
	the same type.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck.c
Comment 7 Jakub Jelinek 2016-01-07 23:03:44 UTC
Assuming fixed.