Commit fe5c443e by Jakub Jelinek Committed by Jakub Jelinek

re PR middle-end/38343 (ice for legal code with -O2)

	PR middle-end/38343
	* builtins.c (fold_builtin_memory_op): Convert len to sizetype
	before using it in POINTER_PLUS_EXPR.

	* gcc.c-torture/compile/pr38343-2.c: New test.

From-SVN: r142363
parent 09ce620e
2008-12-02 Jakub Jelinek <jakub@redhat.com>
PR middle-end/38343
* builtins.c (fold_builtin_memory_op): Convert len to sizetype
before using it in POINTER_PLUS_EXPR.
2008-12-02 Richard Guenther <rguenther@suse.de> 2008-12-02 Richard Guenther <rguenther@suse.de>
PR tree-optimization/38359 PR tree-optimization/38359
...@@ -8993,6 +8993,7 @@ fold_builtin_memory_op (tree dest, tree src, tree len, tree type, bool ignore, i ...@@ -8993,6 +8993,7 @@ fold_builtin_memory_op (tree dest, tree src, tree len, tree type, bool ignore, i
len = fold_build2 (MINUS_EXPR, TREE_TYPE (len), len, len = fold_build2 (MINUS_EXPR, TREE_TYPE (len), len,
ssize_int (1)); ssize_int (1));
len = fold_convert (sizetype, len);
dest = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (dest), dest, len); dest = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (dest), dest, len);
dest = fold_convert (type, dest); dest = fold_convert (type, dest);
if (expr) if (expr)
......
2008-12-02 Jakub Jelinek <jakub@redhat.com>
PR middle-end/38343
* gcc.c-torture/compile/pr38343-2.c: New test.
2008-12-02 Richard Guenther <rguenther@suse.de> 2008-12-02 Richard Guenther <rguenther@suse.de>
PR tree-optimization/38359 PR tree-optimization/38359
......
/* PR middle-end/38343 */
static struct S
{
char f[6];
} s[] = { {"01000"} };
char *
foo (void)
{
return __builtin_stpcpy (s[0].f, "S0022");
}
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