Commit b3006337 by Eric Botcazou Committed by Eric Botcazou

re PR c/13382 (Type information for const pointer disappears during optimisation.)

	PR c/13382
	* c-typeck.c (convert_for_assignment): When converting from
	integral type to pointer type, always call convert.

From-SVN: r74960
parent adb83bee
2003-12-23 Eric Botcazou <ebotcazou@libertysurf.fr>
PR c/13382
* c-typeck.c (convert_for_assignment): When converting from
integral type to pointer type, always call convert.
2003-12-22 Mark Mitchell <mark@codesourcery.com>
* doc/invoke.texi: Deprecate -fwritable-strings.
......
......@@ -3608,13 +3608,11 @@ convert_for_assignment (tree type, tree rhs, const char *errtype,
&& TREE_CODE (TREE_TYPE (rhs)) == INTEGER_TYPE
&& TREE_CODE (TREE_OPERAND (rhs, 0)) == INTEGER_CST
&& integer_zerop (TREE_OPERAND (rhs, 0))))
{
warn_for_assignment ("%s makes pointer from integer without a cast",
errtype, funname, parmnum);
return convert (type, rhs);
}
return null_pointer_node;
}
else if (codel == INTEGER_TYPE && coder == POINTER_TYPE)
{
warn_for_assignment ("%s makes integer from pointer without a cast",
......
2003-12-23 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.dg/null-pointer-1.c: New test.
2003-12-22 Mark Mitchell <mark@codesourcery.com>
* g++.old-deja/g++.jason/template18.C: Remove.
......
/* PR c/13382 */
/* Origin: Richard Hutchinson <richard.hutchinson@asa.co.uk> */
/* Verify that the null initializer is converted to the right
pointer type. */
/* { dg-do compile } */
/* { dg-options "-O" } */
struct t
{
int aMember;
};
struct t *const aPointer = 0;
void foo()
{
int anInt = (aPointer == 0) ? 0 : aPointer->aMember;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment