This is the mail archive of the 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]

Re: [PATCH] convert MIN_EXPR operands to the same type (PR 87059)

On Sat, Aug 25, 2018 at 12:13 PM, Jeff Law <> wrote:
> On 08/24/2018 01:06 PM, Martin Sebor wrote:
>> PR 87059 points out an ICE in the recently enhanced VRP code
>> that was traced back to a MIN_EXPR built out of operands of
>> types with different sign by expand_builtin_strncmp().
>> The attached patch adjusts the function to make sure both
>> operands have the same type, and to make these mismatches
>> easier to detect, also adds an assertion to fold_binary_loc()
>> for these expressions.
>> Bootstrapped on x86_64-linux.
>> Martin
>> PS Aldy, I have not tested this on powerpc64le.
>> gcc-87059.diff
>> PR tree-optimization/87059 - internal compiler error: in set_value_range
>> gcc/ChangeLog:
>>       PR tree-optimization/87059
>>       * builtins.c (expand_builtin_strncmp): Convert MIN_EXPR operand
>>       to the same type as the other.
>>       * fold-const.c (fold_binary_loc): Assert expectation.
> I bootstrapped (but did not regression test) this on ppc64le and also
> built the linux kernel (which is where my tester tripped over this problem).
> Approved and installed on the trunk.

This caused:

[hjl@gnu-skl-1 gcc]$  /export/gnu/import/git/gcc-test/bld/gcc/xgcc
 -w -O -S
during RTL pass: expand
In function \u2018test_strnlen_str_range\u2019:
internal compiler error: in fold_binary_loc, at fold-const.c:9333
51 |   A (strnlen ("",     r_0_3) == 0);
   |      ^~~~~~~~~~~~~~~~~~~~~~~
note: in definition of macro \u2018A\u2019
14 |   ((expr) ? (void)0      \
   |     ^~~~
0x61197a fold_binary_loc(unsigned int, tree_code, tree_node*,
tree_node*, tree_node*)
0xa1ff1a fold_build2_loc(unsigned int, tree_code, tree_node*,
tree_node*, tree_node*)
0x88b881 expand_builtin_strnlen
0x897d85 expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int)
0x9e2177 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
0x9ecf8d expand_expr_real(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
0x9ecf8d store_expr(tree_node*, rtx_def*, int, bool, bool)
0x9ee887 expand_assignment(tree_node*, tree_node*, bool)
0x8ba0a2 expand_call_stmt
0x8ba0a2 expand_gimple_stmt_1
0x8ba0a2 expand_gimple_stmt
0x8bb307 expand_gimple_basic_block
0x8c04f7 execute
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <> for instructions.
[hjl@gnu-skl-1 gcc]$


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