Iain Buclaw avatar Iain Buclaw committed b805b62

Issue #200 - Optimization breaks condition variables

Comments (0)

Files changed (1)

        When optimization is turned on, this whole process results in
        no extra code!
     */
+    /* Also applies to integral types, where the result in EAX gets
+       written with '0' before return under certain optimisations.
+     */
     /* This would apply to complex types as well, but GDC currently
        returns complex types as a struct instead of in ST(0) and ST(1).
      */
-    if (inlineAsm && ! naked && type->nextOf()->isreal())
+    if ((type->nextOf()->isreal() || type->nextOf()->isintegral())
+            && inlineAsm && ! naked)
     {
         tree result_var = irs->localVar(TREE_TYPE(result_decl));
 
         tree nop_str = build_string(0, "");
-        tree cns_str = build_string(2, "=t");
+        tree cns_str;
+        if (type->nextOf()->isreal())
+            cns_str = build_string(2, "=t");
+        else
+            cns_str = build_string(2, "=a");
+
         tree out_arg = tree_cons(tree_cons(NULL_TREE, cns_str, NULL_TREE),
             result_var, NULL_TREE);
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.