re PR c/37106 (ICE with -fpic or -fPIC: in mems_in_disjoint_alias_sets_p, at alias.c:278)

PR c/37106
	* c-common.c (parse_optimize_options): Save and restore
	flag_strict_aliasing around decode_options call.

	* gcc.dg/pr37106-1.c: New test.
	* gcc.dg/pr37106-2.c: New test.

From-SVN: r141584
This commit is contained in:
Jakub Jelinek 2008-11-04 21:06:33 +01:00 committed by Jakub Jelinek
parent 5c6ed53afc
commit cbc19f3932
5 changed files with 72 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2008-11-04 Jakub Jelinek <jakub@redhat.com>
PR c/37106
* c-common.c (parse_optimize_options): Save and restore
flag_strict_aliasing around decode_options call.
2008-11-04 Uros Bizjak <ubizjak@gmail.com>
* config/i386/driver-i386.c (enum vendor_signatures): New enum.

View file

@ -6979,6 +6979,7 @@ parse_optimize_options (tree args, bool attr_p)
bool ret = true;
unsigned opt_argc;
unsigned i;
int saved_flag_strict_aliasing;
const char **opt_argv;
tree ap;
@ -7069,9 +7070,14 @@ parse_optimize_options (tree args, bool attr_p)
for (i = 1; i < opt_argc; i++)
opt_argv[i] = VEC_index (const_char_p, optimize_args, i);
saved_flag_strict_aliasing = flag_strict_aliasing;
/* Now parse the options. */
decode_options (opt_argc, opt_argv);
/* Don't allow changing -fstrict-aliasing. */
flag_strict_aliasing = saved_flag_strict_aliasing;
VEC_truncate (const_char_p, optimize_args, 0);
return ret;
}

View file

@ -1,3 +1,9 @@
2008-11-04 Jakub Jelinek <jakub@redhat.com>
PR c/37106
* gcc.dg/pr37106-1.c: New test.
* gcc.dg/pr37106-2.c: New test.
2008-11-03 Chao-ying Fu <fu@mips.com>
* gcc.target/mips/dsp-ctrl.c: New test.

View file

@ -0,0 +1,27 @@
/* PR c/37106 */
/* { dg-do compile } */
/* { dg-options "-O1" } */
/* { dg-options "-O1 -fpic" { target fpic } } */
#define SIZE 256
float a[SIZE], b[SIZE], c[SIZE];
void opt3 (void) __attribute__((__optimize__(3)));
void
opt3 (void)
{
int i;
for (i = 0; i < SIZE; i++)
a[i] = b[i] + c[i];
}
void
not_opt3 (void)
{
int i;
for (i = 0; i < SIZE; i++)
a[i] = b[i] - c[i];
}

View file

@ -0,0 +1,27 @@
/* PR c/37106 */
/* { dg-do compile } */
/* { dg-options "-O3" } */
/* { dg-options "-O3 -fpic" { target fpic } } */
#define SIZE 256
float a[SIZE], b[SIZE], c[SIZE];
void non_opt3 (void) __attribute__((__optimize__(1)));
void
not_opt3 (void)
{
int i;
for (i = 0; i < SIZE; i++)
a[i] = b[i] - c[i];
}
void
opt3 (void)
{
int i;
for (i = 0; i < SIZE; i++)
a[i] = b[i] + c[i];
}