]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
expr.c (expand_expr): If an ABS_EXPR has a complex type, abort.
authorRoger Sayle <roger@eyesopen.com>
Tue, 12 Aug 2003 01:45:23 +0000 (01:45 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Tue, 12 Aug 2003 01:45:23 +0000 (01:45 +0000)
* expr.c (expand_expr): If an ABS_EXPR has a complex type, abort.
* c-typeck.c (build_unary_op): COMPLEX_TYPE is not a valid
typecode for an ABS_EXPR.

* doc/c-tree.texi: Document ABS_EXPR.

From-SVN: r70349

gcc/ChangeLog
gcc/c-typeck.c
gcc/doc/c-tree.texi
gcc/expr.c

index 39d3f203361de543c8e07139b9fb1f6db2f19b7d..92b6a3eb395cd83be64adde4bcfcd730480637f5 100644 (file)
@@ -1,3 +1,11 @@
+2003-08-11  Roger Sayle  <roger@eyesopen.com>
+
+       * expr.c (expand_expr): If an ABS_EXPR has a complex type, abort.
+       * c-typeck.c (build_unary_op): COMPLEX_TYPE is not a valid
+       typecode for an ABS_EXPR.
+
+       * doc/c-tree.texi: Document ABS_EXPR.
+
 2003-08-11  Roger Sayle  <roger@eyesopen.com>
 
        * fold-const.c (fold): Optimize any associative floating point
index 7d29b196e957d3f200c6984271391646786f873f..224741bf819b98c71b13a573ace6490dc8239e3b 100644 (file)
@@ -2152,8 +2152,7 @@ build_unary_op (enum tree_code code, tree xarg, int flag)
       break;
 
     case ABS_EXPR:
-      if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE
-           || typecode == COMPLEX_TYPE))
+      if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE))
        {
          error ("wrong type argument to abs");
          return error_mark_node;
index e605d738155bbc7c915b0e7485bc294dd027f93f..29ccaec317dedfeaebda8caf7922066bb9c29da7 100644 (file)
@@ -1720,6 +1720,7 @@ This macro returns the attributes on the type @var{type}.
 @findex PTRMEM_CST_MEMBER
 @tindex VAR_DECL
 @tindex NEGATE_EXPR
+@tindex ABS_EXPR
 @tindex BIT_NOT_EXPR
 @tindex TRUTH_NOT_EXPR
 @tindex ADDR_EXPR
@@ -1915,6 +1916,20 @@ determined by looking at the type of the expression.
 The behavior of this operation on signed arithmetic overflow is
 controlled by the @code{flag_wrapv} and @code{flag_trapv} variables.
 
+@item ABS_EXPR
+These nodes represent the absolute value of the single operand, for
+both integer and floating-point types.  This is typically used to
+implement the @code{abs}, @code{labs} and @code{llabs} builtins for
+integer types, and the @code{fabs}, @code{fabsf} and @code{fabsl}
+builtins for floating point types.  The type of abs operation can
+be determined by looking at the type of the expression.
+
+This node is not used for complex types.  To represent the modulus
+or complex abs of a complex value, use the @code{BUILT_IN_CABS},
+@code{BUILT_IN_CABSF} or @code{BUILT_IN_CABSL} builtins, as used
+to implement the C99 @code{cabs}, @code{cabsf} and @code{cabsl}
+built-in functions.
+
 @item BIT_NOT_EXPR
 These nodes represent bitwise complement, and will always have integral
 type.  The only operand is the value to be complemented.
index 47c4f92adac99c21974f84c5e59686973f3c2614..f2c21c4d82d390a1e5df93427638e7a6ffffb5c0 100644 (file)
@@ -8475,10 +8475,10 @@ expand_expr (tree exp, rtx target, enum machine_mode tmode, enum expand_modifier
       if (modifier == EXPAND_STACK_PARM)
        target = 0;
 
-      /* Handle complex values specially.  */
+      /* ABS_EXPR is not valid for complex arguments.  */
       if (GET_MODE_CLASS (mode) == MODE_COMPLEX_INT
          || GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT)
-       return expand_complex_abs (mode, op0, target, unsignedp);
+       abort ();
 
       /* Unsigned abs is simply the operand.  Testing here means we don't
         risk generating incorrect code below.  */