Bug 54664 - expand_gimple_cond -Wtype-limits warning for predictably small BRANCH_COST
Summary: expand_gimple_cond -Wtype-limits warning for predictably small BRANCH_COST
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: 6.0
Assignee: pkoning
URL:
Keywords: build, diagnostic
Depends on:
Blocks: enable-werror-always Wtype-limits
  Show dependency treegraph
 
Reported: 2012-09-21 18:35 UTC by Jorn Wolfgang Rennecke
Modified: 2024-04-11 02:28 UTC (History)
3 users (show)

See Also:
Host:
Target: pdp11-aout
Build:
Known to work:
Known to fail: 4.9.1, 5.0
Last reconfirmed: 2021-03-19 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jorn Wolfgang Rennecke 2012-09-21 18:35:45 UTC
g++ -c   -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -fno-exceptions -fno-rtti -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../../gcc/gcc -I../../../gcc/gcc/. -I../../../gcc/gcc/../include -I../../../gcc/gcc/../libcpp/include  -I../../../gcc/gcc/../libdecnumber -I../../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber    ../../../gcc/gcc/cfgexpand.c -o cfgexpand.o
../../../gcc/gcc/cfgexpand.c: In function ‘basic_block_def* expand_gimple_cond(basic_block, gimple)’:
../../../gcc/gcc/cfgexpand.c:1810:65: error: comparison is always true due to limited range of data type [-Werror=type-limits]
    else if (BRANCH_COST (optimize_insn_for_speed_p (), false) < 4)
                                                                 ^
cc1plus: all warnings being treated as errors
make[2]: *** [cfgexpand.o] Error 1

pdp11.h defines BRANCH_COST as a macro that yield either 0 or 1.

cfgexpand.c:expand_gimple_cond compares this to 4.  Because of the warning
options we use for building cfgexpand.o, we cant't build it for pdp11
configured with --emable-werror-always.
Comment 1 Hans-Peter Nilsson 2014-07-29 11:10:41 UTC
Also seen for 4.9.1 and 4.10.0 i.e. trunk r212879.
Comment 2 Eric Gallager 2018-05-07 20:32:39 UTC
(In reply to Hans-Peter Nilsson from comment #1)
> Also seen for 4.9.1 and 4.10.0 i.e. trunk r212879.

4.10.0 became 5.0
Comment 3 Eric Gallager 2018-08-07 03:23:03 UTC
(In reply to Eric Gallager from comment #2)
> (In reply to Hans-Peter Nilsson from comment #1)
> > Also seen for 4.9.1 and 4.10.0 i.e. trunk r212879.
> 
> 4.10.0 became 5.0

...and regardless of which way it's numbered, that branch is closed now anyways.
Comment 4 Eric Gallager 2021-03-19 22:01:50 UTC
ASSIGNED since someone put themselves as the assignee.
Comment 5 paulkoning 2021-03-19 22:08:17 UTC
I didn't realize that's part of the protocol.  Thanks Eric.

	paul

> On Mar 19, 2021, at 6:01 PM, egallager at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org> wrote:
> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54664
> 
> Eric Gallager <egallager at gcc dot gnu.org> changed:
> 
>           What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                 CC|                            |egallager at gcc dot gnu.org
>     Ever confirmed|0                           |1
>   Last reconfirmed|2013-02-25 00:00:00         |2021-03-19
>             Status|UNCONFIRMED                 |ASSIGNED
> 
> --- Comment #4 from Eric Gallager <egallager at gcc dot gnu.org> ---
> ASSIGNED since someone put themselves as the assignee.
> 
> -- 
> You are receiving this mail because:
> You are on the CC list for the bug.
> You are the assignee for the bug.
Comment 6 Andrew Pinski 2024-04-11 02:28:14 UTC
Fixed in GCC 6 by r6-3577-gef295bcefe9791 (though BRANCH_COST changed again in GCC 9 to be defined as 1 in r9-1500-gb4324a144b4499 ).