* c-typeck.c (build_unary_op): COMPLEX_TYPE is not a valid
typecode for an ABS_EXPR.
* doc/c-tree.texi: Document ABS_EXPR.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@70349
138bc75d-0d04-0410-961f-
82ee72b054a4
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
operator with -funsafe-math-optimizations, not just MULT_EXPR.
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;
@findex PTRMEM_CST_MEMBER
@tindex VAR_DECL
@tindex NEGATE_EXPR
+@tindex ABS_EXPR
@tindex BIT_NOT_EXPR
@tindex TRUTH_NOT_EXPR
@tindex ADDR_EXPR
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.
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. */