Hi! On 2020-04-23T21:04:35+0200, Richard Biener <rguent...@suse.de> wrote: > On April 23, 2020 8:19:55 PM GMT+02:00, Jakub Jelinek <ja...@redhat.com> > wrote: >>[patch] instead uses an auto_vec and builds them in the reverse >>order >>so when they are built, they are built with the correct operands. >> >>Bootstrapped/regtested on powerpc64{,le}-linux, ok for trunk? > > OK.
(That got pushed in commit bca558de2a24b2a78c6a321d6cec384e07759d77 "tree: Fix up get_narrower [PR94724]".) >>--- gcc/tree.c.jj 2020-04-04 09:14:29.808002636 +0200 >>+++ gcc/tree.c 2020-04-23 11:07:34.003675831 +0200 >>@@ -8881,18 +8881,22 @@ get_narrower (tree op, int *unsignedp_pt Note existing 'op' variable here... >> >> if (TREE_CODE (op) == COMPOUND_EXPR) >> { >>- while (TREE_CODE (op) == COMPOUND_EXPR) >>+ do >> op = TREE_OPERAND (op, 1); >>+ while (TREE_CODE (op) == COMPOUND_EXPR); >> tree ret = get_narrower (op, unsignedp_ptr); >> if (ret == op) >> return win; >>- op = win; >>- for (tree *p = &win; TREE_CODE (op) == COMPOUND_EXPR; >>- op = TREE_OPERAND (op, 1), p = &TREE_OPERAND (*p, 1)) >>- *p = build2_loc (EXPR_LOCATION (op), COMPOUND_EXPR, >>- TREE_TYPE (ret), TREE_OPERAND (op, 0), >>- ret); >>- return win; >>+ auto_vec <tree, 16> v; >>+ unsigned int i; >>+ for (tree op = win; TREE_CODE (op) == COMPOUND_EXPR; ..., and new 'op' variable here. >>+ op = TREE_OPERAND (op, 1)) >>+ v.safe_push (op); >>+ FOR_EACH_VEC_ELT_REVERSE (v, i, op) >>+ ret = build2_loc (EXPR_LOCATION (op), COMPOUND_EXPR, >>+ TREE_TYPE (win), TREE_OPERAND (op, 0), >>+ ret); >>+ return ret; >> } >> while (TREE_CODE (op) == NOP_EXPR) >> { Old compilers: g++ (Sourcery CodeBench 2014.05-45) 4.8.3 20140320 (prerelease) ..., and also: g++-4.6 (Ubuntu/Linaro 4.6.3-10ubuntu1) 4.6.3 20120918 (prerelease) ... warn: {+[...]/gcc/tree.c: In function 'tree_node* get_narrower(tree, int*)':+} {+[...]/gcc/tree.c:8897:55: warning: name lookup of 'op' changed [enabled by default]+} {+ FOR_EACH_VEC_ELT_REVERSE (v, i, op)+} {+ ^+} {+[...]/gcc/tree.c:8877:1: warning: matches this 'op' under ISO standard rules [enabled by default]+} {+ get_narrower (tree op, int *unsignedp_ptr)+} {+ ^+} {+[...]/gcc/tree.c:8894:17: warning: matches this 'op' under old rules [enabled by default]+} {+ for (tree op = win; TREE_CODE (op) == COMPOUND_EXPR;+} {+ ^+} ("Interesting.") The bootstrapped GCC itself doesn't diagnose this. Is there something to be worried about? (Certainly the variable shadowing could be avoided?) Grüße Thomas ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter