[Bug target/42957] New: ARM: Segfault when invalid -mfpu argument is specified.
rmansfield at qnx dot com
gcc-bugzilla@gcc.gnu.org
Thu Feb 4 16:12:00 GMT 2010
ryan@zoidberg:~/gnu/gcc/trunk/build/gcc$ ./xgcc -v
Using built-in specs.
COLLECT_GCC=./xgcc
Target: arm-unknown-linux-gnueabi
Configured with: ../configure --target=arm-unknown-linux-gnueabi
--prefix=/home/ryan/x-tools/arm-unknown-linux-gnueabi
--with-sysroot=/home/ryan/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi//sys-root
--enable-languages=c,c++ --disable-multilib --with-float=soft
--disable-sjlj-exceptions --enable-__cxa_atexit
--with-local-prefix=/home/ryan/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sys-root
--disable-nls --enable-threads=posix --enable-symvers=gnu --enable-c99
--enable-long-long --enable-target-optspace
Thread model: posix
gcc version 4.5.0 20100204 (experimental) [trunk revision 156492] (GCC)
ryan@zoidberg:~/gnu/gcc/trunk/build/gcc$ touch t.c
ryan@zoidberg:~/gnu/gcc/trunk/build/gcc$ ./cc1plus -quiet t.c -mfpu=foo
t.c:1:0: error: invalid floating point option: -mfpu=foo
t.c:1:0: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
(gdb) bt
#0 0x08a06fd6 in arm_override_options () at ../../gcc/config/arm/arm.c:1645
#1 0x087b7a6c in process_options () at ../../gcc/toplev.c:1810
#2 0x087b8528 in do_compile () at ../../gcc/toplev.c:2389
#3 0x087b8624 in toplev_main (argc=4, argv=0xbffff364)
at ../../gcc/toplev.c:2447
#4 0x083cd2ab in main (argc=4, argv=0xbffff364) at ../../gcc/main.c:35
Patch:
2010-02-04 Ryan Mansfield <rmansfield@qnx.com>
PR target/xxxxx
* config/arm/arm.c (arm_override_options): Handle invalid arguments to
-mfpu.
Index: arm.c
===================================================================
--- arm.c (revision 156492)
+++ arm.c (working copy)
@@ -1292,6 +1292,7 @@
unsigned i;
enum processor_type target_arch_cpu = arm_none;
enum processor_type selected_cpu = arm_none;
+ const char *default_fpu_name;
/* Set up the flags based on the cpu/architecture selected by the user. */
for (i = ARRAY_SIZE (arm_select); i--;)
@@ -1618,29 +1619,31 @@
target_fpe_name);
}
- if (target_fpu_name == NULL)
- {
#ifdef FPUTYPE_DEFAULT
- target_fpu_name = FPUTYPE_DEFAULT;
+ default_fpu_name = FPUTYPE_DEFAULT;
#else
- if (arm_arch_cirrus)
- target_fpu_name = "maverick";
- else
- target_fpu_name = "fpe2";
+ if (arm_arch_cirrus)
+ default_fpu_name = "maverick";
+ else
+ default_fpu_name = "fpe2";
#endif
- }
arm_fpu_desc = NULL;
for (i = 0; i < ARRAY_SIZE (all_fpus); i++)
{
- if (streq (all_fpus[i].name, target_fpu_name))
- {
- arm_fpu_desc = &all_fpus[i];
- break;
- }
- }
- if (!arm_fpu_desc)
- error ("invalid floating point option: -mfpu=%s", target_fpu_name);
+ if (streq (all_fpus[i].name, default_fpu_name))
+ arm_fpu_desc = &all_fpus[i];
+ if (target_fpu_name)
+ {
+ if (streq (all_fpus[i].name, target_fpu_name))
+ {
+ arm_fpu_desc = &all_fpus[i];
+ break;
+ }
+ if (i == ARRAY_SIZE (all_fpus) - 1)
+ error ("invalid floating point option: -mfpu=%s", target_fpu_name);
+ }
+ }
switch (arm_fpu_desc->model)
{
--
Summary: ARM: Segfault when invalid -mfpu argument is specified.
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rmansfield at qnx dot com
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: arm-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42957
More information about the Gcc-bugs
mailing list