@@ -517,6 +517,24 @@ d_save_expr (tree exp)
517517  return  exp;
518518}
519519
520+ /*  Build an unary op CODE to the expression ARG.  If the expression can be
521+    broken down so that the operation is applied only to the part whose value we 
522+    care about, then handle lowering to keep lvalues trivial.  */  
523+ 
524+ static  tree
525+ build_unary_op  (tree_code code, tree type, tree arg)
526+ {
527+   /*  Given ((e1, ...), eN):
528+      Treat the last RHS 'eN' expression as the lvalue part.  */  
529+   if  (TREE_CODE  (arg) == COMPOUND_EXPR)
530+     {
531+       tree result = build_unary_op  (code, type, TREE_OPERAND  (arg, 1 ));
532+       return  compound_expr  (TREE_OPERAND  (arg, 0 ), result);
533+     }
534+ 
535+   return  fold_build1_loc  (input_location, code, type, arg);
536+ }
537+ 
520538/*  VALUEP is an expression we want to pre-evaluate or perform a computation on.
521539   The expression returned by this function is the part whose value we don't 
522540   care about, storing the value in VALUEP.  Callers must ensure that the 
@@ -1360,11 +1378,7 @@ build_nop (tree type, tree exp)
13601378  if  (error_operand_p  (exp))
13611379    return  exp;
13621380
1363-   /*  Maybe rewrite: cast(TYPE)(e1, e2) => (e1, cast(TYPE) e2)  */ 
1364-   tree init = stabilize_expr  (&exp);
1365-   exp = fold_build1_loc  (input_location, NOP_EXPR, type, exp);
1366- 
1367-   return  compound_expr  (init, exp);
1381+   return  build_unary_op  (NOP_EXPR, type, exp);
13681382}
13691383
13701384/*  Return EXP to be viewed as being another type TYPE.  Same as build_nop,
0 commit comments