[Bug target/31161] __builtin_cexpi is broken on Darwin

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Mar 16 09:50:00 GMT 2007



------- Comment #14 from rguenth at gcc dot gnu dot org  2007-03-16 09:50 -------
Yes, it's supposed to call cexp(complex(0,x)), but now looking at the code
there
seems to be a typo:

      narg = fold_build2 (COMPLEX_EXPR, ctype,
                          build_real (type, dconst0), arg);

      /* Make sure not to fold the cexp call again.  */
      call = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (fn)), fn);
      return expand_expr (build_call_nary (ctype, call, 1, arg),
                          target, VOIDmode, 0);

it builds the call with 'arg' instead of 'narg'.  Argh.  This bug was
introduced
by the CALL_EXPR changes:

       narg = fold_build2 (COMPLEX_EXPR, ctype,
                          build_real (type, dconst0), arg);

       /* Make sure not to fold the cexp call again.  */
       call = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (fn)), fn);
-      return expand_expr (build3 (CALL_EXPR, ctype, call,
-                                 build_tree_list (NULL_TREE, narg),
-                                 NULL_TREE), target, VOIDmode, 0);
+      return expand_expr (build_call_nary (ctype, call, 1, arg), 
+                         target, VOIDmode, 0);

I'll fix it in a second.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31161



More information about the Gcc-bugs mailing list