Issue Details (XML | Word | Printable)

Key: PCC-465
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Anders Magnusson
Reporter: Volkmar Klatt
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.

long long issue, maybe just the result of undefined evaluation order

Created: 10/Aug/14 03:36 PM   Updated: 17/Aug/14 05:43 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

File Attachments: 1. Text File tr_20140809_64.c (0.8 kB)

pcc 1.1.0.DEVEL 20140807 for i686-pc-linux-gnu

 Description  « Hide
/* tr_20140809_64.c - test file for pcc - Volkmar Klatt
   long long issue,
   maybe just the result of undefined evaluation order,
   nevertheless it's strange

   pcc 1.1.0.DEVEL 20140807 for i686-pc-linux-gnu

   gcc tr_20140809_64.c -o z # or other compiler
   pcc tr_20140809_64.c -o zz
   ./z --> 2
   ./zz --> 1 */
#include <stdio.h>

struct S {
   int f;

long long func_lolo(struct S p) { return 1LL; }

int func_wherever(void) { return 2; }

int main(void)
   struct S s = {3};
   long long ll = 1LL;
   long long *pll = &ll;

   func_lolo(s) != ((*pll) = func_wherever()); /* also: & | ^ != */

   printf("%lli\n", *pll);
   return 0;

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson added a comment - 12/Aug/14 08:46 AM
This is an evaluation order error, and an evil one :-/

Anders Magnusson added a comment - 17/Aug/14 05:43 PM
Actually two bugs, both introduced when fixing other longlong bugs:
- Treat TEMP nodes as REG when checking addressability (unneccessary spill).
- Do not spill left side of an ASSIGN, that is just plain wrong.