c-typeck.c (initializer_constant_valid_p): Allow conversion of 0 of any size to a pointer.
* c-typeck.c (initializer_constant_valid_p): Allow conversion of 0 of any size to a pointer. From-SVN: r21697
This commit is contained in:
parent
6ece24871f
commit
0d906a5f36
@ -1,3 +1,8 @@
|
|||||||
|
Thu Aug 13 15:24:48 1998 Jason Merrill <jason@yorick.cygnus.com>
|
||||||
|
|
||||||
|
* c-typeck.c (initializer_constant_valid_p): Allow conversion of 0
|
||||||
|
of any size to a pointer.
|
||||||
|
|
||||||
Thu Aug 13 12:53:13 1998 Jim Wilson <wilson@cygnus.com>
|
Thu Aug 13 12:53:13 1998 Jim Wilson <wilson@cygnus.com>
|
||||||
|
|
||||||
* i386/winnt.c (i386_pe_asm_file_end): Check TREE_SYMBOL_REFERENCED.
|
* i386/winnt.c (i386_pe_asm_file_end): Check TREE_SYMBOL_REFERENCED.
|
||||||
@ -567,7 +572,7 @@ Tue Jul 28 22:31:12 1998 Craig Burley <burley@gnu.org>
|
|||||||
SUBREG, MEM.
|
SUBREG, MEM.
|
||||||
* rtlanal.c (replace_rtx): Prohibit replaces in CONST_DOUBLE.
|
* rtlanal.c (replace_rtx): Prohibit replaces in CONST_DOUBLE.
|
||||||
|
|
||||||
Tue Jul 28 11:33:09 1998 Mark Mitchell <mark@markmitchell.com>
|
|
||||||
|
|
||||||
* cplus-dem.c (type_kind_t): New type.
|
* cplus-dem.c (type_kind_t): New type.
|
||||||
(demangle_template_value_parm): Add type_kind_t parameter. Rely
|
(demangle_template_value_parm): Add type_kind_t parameter. Rely
|
||||||
|
@ -4423,13 +4423,18 @@ initializer_constant_valid_p (value, endtype)
|
|||||||
return initializer_constant_valid_p (TREE_OPERAND (value, 0),
|
return initializer_constant_valid_p (TREE_OPERAND (value, 0),
|
||||||
endtype);
|
endtype);
|
||||||
|
|
||||||
/* Likewise conversions from int to pointers. */
|
/* Likewise conversions from int to pointers, but also allow
|
||||||
|
conversions from 0. */
|
||||||
if (TREE_CODE (TREE_TYPE (value)) == POINTER_TYPE
|
if (TREE_CODE (TREE_TYPE (value)) == POINTER_TYPE
|
||||||
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == INTEGER_TYPE
|
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == INTEGER_TYPE)
|
||||||
&& (TYPE_PRECISION (TREE_TYPE (value))
|
{
|
||||||
<= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value, 0)))))
|
if (integer_zerop (TREE_OPERAND (value, 0)))
|
||||||
return initializer_constant_valid_p (TREE_OPERAND (value, 0),
|
return null_pointer_node;
|
||||||
endtype);
|
else if (TYPE_PRECISION (TREE_TYPE (value))
|
||||||
|
<= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value, 0))))
|
||||||
|
return initializer_constant_valid_p (TREE_OPERAND (value, 0),
|
||||||
|
endtype);
|
||||||
|
}
|
||||||
|
|
||||||
/* Allow conversions to union types if the value inside is okay. */
|
/* Allow conversions to union types if the value inside is okay. */
|
||||||
if (TREE_CODE (TREE_TYPE (value)) == UNION_TYPE)
|
if (TREE_CODE (TREE_TYPE (value)) == UNION_TYPE)
|
||||||
|
Loading…
Reference in New Issue
Block a user