File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,9 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) {
7878 switch (CE->getCastKind ()) {
7979
8080 case CK_LValueToRValue: {
81+ if (DiscardResult)
82+ return this ->discard (SubExpr);
83+
8184 return dereference (
8285 SubExpr, DerefKind::Read,
8386 [](PrimType) {
@@ -86,9 +89,7 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) {
8689 },
8790 [this , CE](PrimType T) {
8891 // Pointer on stack - dereference it.
89- if (!this ->emitLoadPop (T, CE))
90- return false ;
91- return DiscardResult ? this ->emitPop (T, CE) : true ;
92+ return this ->emitLoadPop (T, CE);
9293 });
9394 }
9495
Original file line number Diff line number Diff line change @@ -98,3 +98,15 @@ void f (int z) {
9898
9999int expr ;
100100int chooseexpr [__builtin_choose_expr (1 , 1 , expr )];
101+
102+ int somefunc (int i ) {
103+ return (i , 65537 ) * 65537 ; // expected-warning {{left operand of comma operator has no effect}} \
104+ // expected-warning {{overflow in expression; result is 131073}} \
105+ // pedantic-expected-warning {{left operand of comma operator has no effect}} \
106+ // pedantic-expected-warning {{overflow in expression; result is 131073}} \
107+ // ref-warning {{left operand of comma operator has no effect}} \
108+ // ref-warning {{overflow in expression; result is 131073}} \
109+ // pedantic-ref-warning {{left operand of comma operator has no effect}} \
110+ // pedantic-ref-warning {{overflow in expression; result is 131073}}
111+
112+ }
You can’t perform that action at this time.
0 commit comments