+
+void
+testBug1839299(void)
+{
+ volatile char code* * p;
+ unsigned long v = 0;
+//'Values[0].Name' subexpression is evaluated as follows first:
+//mov r2,#_Values
+//mov r3,#(_Values >> 8)
+//mov r4,#(_Values >> 16) ;this is wrong - see bug 1839277
+ p= i ? Values[0].Name : Values[1].Name;
+//this assignment has some sideeffect on the following one
+//in fact it is the evaluation of 'Values[0].Name' itself has the effect, not the assignment
+ p= Values[0].Name;
+//'Values[0].Name' subexpression is evaluated as follows second:
+//mov r2,#_Values
+//mov r3,#(_Values >> 8)
+//mov r4,#0x00 ;this is different from first occurrence but also wrong
+ p= i ? Values[0].Name : Values[1].Name;
+#if defined(SDCC_mcs51)
+ v = (unsigned long)p;
+ ASSERT((unsigned char)(v>>16)==0x80);
+#endif
+}