public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/48767] New: compiler error: Segmentation fault with set void in va_arg
@ 2011-04-26 0:48 iwamatsu at nigauri dot org
2011-04-26 9:31 ` [Bug target/48767] " kkojima at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: iwamatsu at nigauri dot org @ 2011-04-26 0:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48767
Summary: compiler error: Segmentation fault with set void in
va_arg
Product: gcc
Version: 4.4.6
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: iwamatsu@nigauri.org
CC: kkojima@gcc.gnu.org
Host: sh4-linux-gnu
Target: sh4-linux-gnu
Build: sh4-linux-gnu
Hi,
When we set void in va_arg, it becomes Segmentation fault.
This problem was confirmed on gcc-4.3, 4.4, 4.5 and 4.6.
$ cat a.c
#include <stdarg.h>
void f(va_list ap) { va_arg(ap,void); }
$ gcc -c a.c
a.c: In function 'f':
a.c:2: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.4/README.Bugs> for instructions.
$gcc -v
Using built-in specs.
Target: sh4-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.6-2'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.4 --enable-shared --enable-multiarch
--with-multiarch-defaults=sh4-linux-gnu --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4
--libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-objc-gc --with-multilib-list=m4,m4-nofpu --with-cpu=sh4
--enable-checking=release --build=sh4-linux-gnu --host=sh4-linux-gnu
--target=sh4-linux-gnu
Thread model: posix
gcc version 4.4.6 (Debian 4.4.6-2)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/48767] compiler error: Segmentation fault with set void in va_arg
2011-04-26 0:48 [Bug c/48767] New: compiler error: Segmentation fault with set void in va_arg iwamatsu at nigauri dot org
@ 2011-04-26 9:31 ` kkojima at gcc dot gnu.org
2011-04-27 2:40 ` iwamatsu at nigauri dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: kkojima at gcc dot gnu.org @ 2011-04-26 9:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48767
Kazumoto Kojima <kkojima at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target|sh4-linux-gnu |sh*-*-*
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011.04.26 09:26:30
Component|c |target
Host|sh4-linux-gnu |
Ever Confirmed|0 |1
Build|sh4-linux-gnu |
--- Comment #1 from Kazumoto Kojima <kkojima at gcc dot gnu.org> 2011-04-26 09:26:30 UTC ---
This is a target problem. The patch below will fix it.
BTW, I'm not sure that it's an invalid use of void or not in C,
though g++ treats it as invalid.
* config/sh/sh.c (sh_gimplify_va_arg_expr): Don't call
targetm.calls.must_pass_in_stack for void type.
--- ORIG/trunk/gcc/config/sh/sh.c 2011-04-23 09:43:19.000000000 +0900
+++ trunk/gcc/config/sh/sh.c 2011-04-26 10:40:25.000000000 +0900
@@ -8062,9 +8062,14 @@ sh_gimplify_va_arg_expr (tree valist, tr
HOST_WIDE_INT size, rsize;
tree tmp, pptr_type_node;
tree addr, lab_over = NULL, result = NULL;
- int pass_by_ref = targetm.calls.must_pass_in_stack (TYPE_MODE (type), type);
+ bool pass_by_ref;
tree eff_type;
+ if (!VOID_TYPE_P (type))
+ pass_by_ref = targetm.calls.must_pass_in_stack (TYPE_MODE (type), type);
+ else
+ pass_by_ref = false;
+
if (pass_by_ref)
type = build_pointer_type (type);
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/48767] compiler error: Segmentation fault with set void in va_arg
2011-04-26 0:48 [Bug c/48767] New: compiler error: Segmentation fault with set void in va_arg iwamatsu at nigauri dot org
2011-04-26 9:31 ` [Bug target/48767] " kkojima at gcc dot gnu.org
@ 2011-04-27 2:40 ` iwamatsu at nigauri dot org
2011-04-27 12:50 ` kkojima at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: iwamatsu at nigauri dot org @ 2011-04-27 2:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48767
--- Comment #2 from Nobuhiro Iwamatsu <iwamatsu at nigauri dot org> 2011-04-27 02:37:37 UTC ---
Hi,
Thanks for your work.
(In reply to comment #1)
> This is a target problem. The patch below will fix it.
I confirm fix on gcc-4.4, 4,5 and 4.6.
Thanks!
> BTW, I'm not sure that it's an invalid use of void or not in C,
> though g++ treats it as invalid.
Yes, I think too.
I will ask upstream writing such code.
Nobuhiro
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/48767] compiler error: Segmentation fault with set void in va_arg
2011-04-26 0:48 [Bug c/48767] New: compiler error: Segmentation fault with set void in va_arg iwamatsu at nigauri dot org
2011-04-26 9:31 ` [Bug target/48767] " kkojima at gcc dot gnu.org
2011-04-27 2:40 ` iwamatsu at nigauri dot org
@ 2011-04-27 12:50 ` kkojima at gcc dot gnu.org
2011-05-30 6:03 ` iwamatsu at nigauri dot org
2011-05-30 6:05 ` kkojima at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: kkojima at gcc dot gnu.org @ 2011-04-27 12:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48767
Kazumoto Kojima <kkojima at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #3 from Kazumoto Kojima <kkojima at gcc dot gnu.org> 2011-04-27 12:49:09 UTC ---
Fixed on trunk.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/48767] compiler error: Segmentation fault with set void in va_arg
2011-04-26 0:48 [Bug c/48767] New: compiler error: Segmentation fault with set void in va_arg iwamatsu at nigauri dot org
` (2 preceding siblings ...)
2011-04-27 12:50 ` kkojima at gcc dot gnu.org
@ 2011-05-30 6:03 ` iwamatsu at nigauri dot org
2011-05-30 6:05 ` kkojima at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: iwamatsu at nigauri dot org @ 2011-05-30 6:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48767
--- Comment #4 from Nobuhiro Iwamatsu <iwamatsu at nigauri dot org> 2011-05-30 05:36:31 UTC ---
Could you backport earch branches?
If you need patch, I will create.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/48767] compiler error: Segmentation fault with set void in va_arg
2011-04-26 0:48 [Bug c/48767] New: compiler error: Segmentation fault with set void in va_arg iwamatsu at nigauri dot org
` (3 preceding siblings ...)
2011-05-30 6:03 ` iwamatsu at nigauri dot org
@ 2011-05-30 6:05 ` kkojima at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: kkojima at gcc dot gnu.org @ 2011-05-30 6:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48767
--- Comment #5 from Kazumoto Kojima <kkojima at gcc dot gnu.org> 2011-05-30 06:03:35 UTC ---
It isn't a regression, is it?
My gcc-4.2 segfaults too for that testcase.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-05-30 6:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-26 0:48 [Bug c/48767] New: compiler error: Segmentation fault with set void in va_arg iwamatsu at nigauri dot org
2011-04-26 9:31 ` [Bug target/48767] " kkojima at gcc dot gnu.org
2011-04-27 2:40 ` iwamatsu at nigauri dot org
2011-04-27 12:50 ` kkojima at gcc dot gnu.org
2011-05-30 6:03 ` iwamatsu at nigauri dot org
2011-05-30 6:05 ` kkojima at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).