public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/26092] ICE on const function pointer assigned to malloc
2006-02-03 17:18 [Bug c/26092] New: ICE on const function pointer assigned to malloc kohler at cs dot ucla dot edu
@ 2006-02-03 17:18 ` kohler at cs dot ucla dot edu
2006-02-03 18:15 ` [Bug middle-end/26092] [4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: kohler at cs dot ucla dot edu @ 2006-02-03 17:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from kohler at cs dot ucla dot edu 2006-02-03 17:18 -------
Created an attachment (id=10776)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10776&action=view)
preprocessed source
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26092
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/26092] New: ICE on const function pointer assigned to malloc
@ 2006-02-03 17:18 kohler at cs dot ucla dot edu
2006-02-03 17:18 ` [Bug c/26092] " kohler at cs dot ucla dot edu
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: kohler at cs dot ucla dot edu @ 2006-02-03 17:18 UTC (permalink / raw)
To: gcc-bugs
Compiling this source causes an ICE on the call to (*f)(3). Preprocessed
source in an attachment, non-preprocessed source below. The ICE doesn't happen
if "f" is assigned to a user function poiner. The segmentation fault happens
on either Linux (4.0.3 20051201 Debian prerelease) or Mac OS X (4.0.0 Apple
build), and I couldn't find a bugzilla bug for it.
Source:
#include <stdlib.h>
void *(* const f)(size_t) = malloc;
void *gg(void) {
return (*f)(3);
}
Output of "gcc -v -save-temps -c x.c":
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.0 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-awt=gtk-default --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr
--disable-werror --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.0.3 20051201 (prerelease) (Debian 4.0.2-5)
/usr/lib/gcc/i486-linux-gnu/4.0.3/cc1 -E -quiet -v x.c -mtune=i486
-fpch-preprocess -o x.i
ignoring nonexistent directory "/usr/local/include/i486-linux-gnu"
ignoring nonexistent directory "/usr/include/i486-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/lib/gcc/i486-linux-gnu/4.0.3/include
/usr/include
End of search list.
/usr/lib/gcc/i486-linux-gnu/4.0.3/cc1 -fpreprocessed x.i -quiet -dumpbase x.c
-mtune=i486 -auxbase x -version -o x.s
GNU C version 4.0.3 20051201 (prerelease) (Debian 4.0.2-5) (i486-linux-gnu)
compiled by GNU C version 4.0.3 20051201 (prerelease) (Debian 4.0.2-5).
GGC heuristics: --param ggc-min-expand=90 --param ggc-min-heapsize=113175
x.c: In function 'gg':
x.c:6: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.0/README.Bugs>.
--
Summary: ICE on const function pointer assigned to malloc
Product: gcc
Version: 4.0.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kohler at cs dot ucla dot edu
GCC build triplet: i486-linux-gnu
GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26092
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/26092] [4.0/4.1/4.2 Regression] ICE on const function pointer assigned to malloc
2006-02-03 17:18 [Bug c/26092] New: ICE on const function pointer assigned to malloc kohler at cs dot ucla dot edu
2006-02-03 17:18 ` [Bug c/26092] " kohler at cs dot ucla dot edu
@ 2006-02-03 18:15 ` pinskia at gcc dot gnu dot org
2006-02-03 18:19 ` [Bug middle-end/26092] [4.0/4.1/4.2 Regression] ICE on const function pointer assigned to a builtin function pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-03 18:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2006-02-03 18:15 -------
Reduced testcase:
typedef __SIZE_TYPE__ size_t;
extern void *malloc (size_t __size);
void *(* const f)(size_t) = malloc;
void *gg(void) {
return (*f)(3);
}
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Component|c |middle-end
Ever Confirmed|0 |1
GCC build triplet|i486-linux-gnu |
GCC host triplet|i486-linux-gnu |
GCC target triplet|i486-linux-gnu |
Keywords| |ice-on-valid-code
Last reconfirmed|0000-00-00 00:00:00 |2006-02-03 18:15:01
date| |
Summary|ICE on const function |[4.0/4.1/4.2 Regression] ICE
|pointer assigned to malloc |on const function pointer
| |assigned to malloc
Target Milestone|--- |4.0.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26092
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/26092] [4.0/4.1/4.2 Regression] ICE on const function pointer assigned to a builtin function
2006-02-03 17:18 [Bug c/26092] New: ICE on const function pointer assigned to malloc kohler at cs dot ucla dot edu
2006-02-03 17:18 ` [Bug c/26092] " kohler at cs dot ucla dot edu
2006-02-03 18:15 ` [Bug middle-end/26092] [4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
@ 2006-02-03 18:19 ` pinskia at gcc dot gnu dot org
2006-02-03 18:23 ` pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-03 18:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2006-02-03 18:19 -------
2028 /* Try this again in case gimplification exposed something. */
Malloc is just a builtin function, this ICE happens with any builtin function.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[4.0/4.1/4.2 Regression] ICE|[4.0/4.1/4.2 Regression] ICE
|on const function pointer |on const function pointer
|assigned to malloc |assigned to a builtin
| |function
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26092
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/26092] [4.0/4.1/4.2 Regression] ICE on const function pointer assigned to a builtin function
2006-02-03 17:18 [Bug c/26092] New: ICE on const function pointer assigned to malloc kohler at cs dot ucla dot edu
` (2 preceding siblings ...)
2006-02-03 18:19 ` [Bug middle-end/26092] [4.0/4.1/4.2 Regression] ICE on const function pointer assigned to a builtin function pinskia at gcc dot gnu dot org
@ 2006-02-03 18:23 ` pinskia at gcc dot gnu dot org
2006-02-08 12:19 ` jakub at gcc dot gnu dot org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-03 18:23 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2006-02-03 18:23 -------
What happens here is that we call get_callee_fndecl before gimplifying the
expression f(3) and we get back malloc because of code in get_callee_fndecl
for:
/* If this is a readonly function pointer, extract its initial value. */
And then we go along and gimplifiy this expression and we get:
f.0(3) as the expression as the load for f is done before as f.0 = f;.
and then calling get_callee_fndecl on this new expression we get NULL and so we
crash as we pass that to fold_builtins.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26092
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/26092] [4.0/4.1/4.2 Regression] ICE on const function pointer assigned to a builtin function
2006-02-03 17:18 [Bug c/26092] New: ICE on const function pointer assigned to malloc kohler at cs dot ucla dot edu
` (3 preceding siblings ...)
2006-02-03 18:23 ` pinskia at gcc dot gnu dot org
@ 2006-02-08 12:19 ` jakub at gcc dot gnu dot org
2006-02-13 21:28 ` jakub at gcc dot gnu dot org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-02-08 12:19 UTC (permalink / raw)
To: gcc-bugs
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jakub at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2006-02-03 18:15:01 |2006-02-08 12:19:04
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26092
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/26092] [4.0/4.1/4.2 Regression] ICE on const function pointer assigned to a builtin function
2006-02-03 17:18 [Bug c/26092] New: ICE on const function pointer assigned to malloc kohler at cs dot ucla dot edu
` (4 preceding siblings ...)
2006-02-08 12:19 ` jakub at gcc dot gnu dot org
@ 2006-02-13 21:28 ` jakub at gcc dot gnu dot org
2006-02-13 21:29 ` jakub at gcc dot gnu dot org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-02-13 21:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from jakub at gcc dot gnu dot org 2006-02-13 21:28 -------
Subject: Bug 26092
Author: jakub
Date: Mon Feb 13 21:28:03 2006
New Revision: 110927
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110927
Log:
PR middle-end/26092
* gimplify.c (gimplify_call_expr): Don't call get_callee_fndecl
twice if decl is a builtin. When trying again, call get_callee_fndecl
first to verify it is still a builtin.
* gcc.c-torture/compile/20060208-1.c: New test.
Added:
trunk/gcc/testsuite/gcc.c-torture/compile/20060208-1.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/gimplify.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26092
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/26092] [4.0/4.1/4.2 Regression] ICE on const function pointer assigned to a builtin function
2006-02-03 17:18 [Bug c/26092] New: ICE on const function pointer assigned to malloc kohler at cs dot ucla dot edu
` (5 preceding siblings ...)
2006-02-13 21:28 ` jakub at gcc dot gnu dot org
@ 2006-02-13 21:29 ` jakub at gcc dot gnu dot org
2006-02-13 21:42 ` [Bug middle-end/26092] [4.0 " pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-02-13 21:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jakub at gcc dot gnu dot org 2006-02-13 21:29 -------
Subject: Bug 26092
Author: jakub
Date: Mon Feb 13 21:29:13 2006
New Revision: 110928
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110928
Log:
PR middle-end/26092
* gimplify.c (gimplify_call_expr): Don't call get_callee_fndecl
twice if decl is a builtin. When trying again, call get_callee_fndecl
first to verify it is still a builtin.
* gcc.c-torture/compile/20060208-1.c: New test.
Added:
branches/gcc-4_1-branch/gcc/testsuite/gcc.c-torture/compile/20060208-1.c
Modified:
branches/gcc-4_1-branch/gcc/ChangeLog
branches/gcc-4_1-branch/gcc/gimplify.c
branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26092
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/26092] [4.0 Regression] ICE on const function pointer assigned to a builtin function
2006-02-03 17:18 [Bug c/26092] New: ICE on const function pointer assigned to malloc kohler at cs dot ucla dot edu
` (6 preceding siblings ...)
2006-02-13 21:29 ` jakub at gcc dot gnu dot org
@ 2006-02-13 21:42 ` pinskia at gcc dot gnu dot org
2006-02-27 20:29 ` mmitchel at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-13 21:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from pinskia at gcc dot gnu dot org 2006-02-13 21:42 -------
Fixed for 4.2.0 and 4.1.0 at least.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail|4.2.0 4.1.0 4.0.0 4.0.3 |4.0.0 4.0.3
Known to work|3.4.0 3.3.3 3.2.3 3.0.4 |3.4.0 3.3.3 3.2.3 3.0.4
|2.95.3 |2.95.3 4.2.0 4.1.0
Summary|[4.0/4.1/4.2 Regression] ICE|[4.0 Regression] ICE on
|on const function pointer |const function pointer
|assigned to a builtin |assigned to a builtin
|function |function
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26092
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/26092] [4.0 Regression] ICE on const function pointer assigned to a builtin function
2006-02-03 17:18 [Bug c/26092] New: ICE on const function pointer assigned to malloc kohler at cs dot ucla dot edu
` (7 preceding siblings ...)
2006-02-13 21:42 ` [Bug middle-end/26092] [4.0 " pinskia at gcc dot gnu dot org
@ 2006-02-27 20:29 ` mmitchel at gcc dot gnu dot org
2006-02-28 20:09 ` jakub at gcc dot gnu dot org
2006-02-28 22:20 ` pinskia at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-02-27 20:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from mmitchel at gcc dot gnu dot org 2006-02-27 20:29 -------
Jakub, does this patch apply to 4.0.x?
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26092
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/26092] [4.0 Regression] ICE on const function pointer assigned to a builtin function
2006-02-03 17:18 [Bug c/26092] New: ICE on const function pointer assigned to malloc kohler at cs dot ucla dot edu
` (8 preceding siblings ...)
2006-02-27 20:29 ` mmitchel at gcc dot gnu dot org
@ 2006-02-28 20:09 ` jakub at gcc dot gnu dot org
2006-02-28 22:20 ` pinskia at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-02-28 20:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jakub at gcc dot gnu dot org 2006-02-28 19:58 -------
Subject: Bug 26092
Author: jakub
Date: Tue Feb 28 19:58:33 2006
New Revision: 111572
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111572
Log:
PR middle-end/26092
* gimplify.c (gimplify_call_expr): When trying again, call
get_callee_fndecl first to verify it is still a builtin.
* gcc.c-torture/compile/20060208-1.c: New test.
Added:
branches/gcc-4_0-branch/gcc/testsuite/gcc.c-torture/compile/20060208-1.c
Modified:
branches/gcc-4_0-branch/gcc/ChangeLog
branches/gcc-4_0-branch/gcc/gimplify.c
branches/gcc-4_0-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26092
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/26092] [4.0 Regression] ICE on const function pointer assigned to a builtin function
2006-02-03 17:18 [Bug c/26092] New: ICE on const function pointer assigned to malloc kohler at cs dot ucla dot edu
` (9 preceding siblings ...)
2006-02-28 20:09 ` jakub at gcc dot gnu dot org
@ 2006-02-28 22:20 ` pinskia at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-28 22:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from pinskia at gcc dot gnu dot org 2006-02-28 22:20 -------
Fixed.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26092
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2006-02-28 22:20 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-03 17:18 [Bug c/26092] New: ICE on const function pointer assigned to malloc kohler at cs dot ucla dot edu
2006-02-03 17:18 ` [Bug c/26092] " kohler at cs dot ucla dot edu
2006-02-03 18:15 ` [Bug middle-end/26092] [4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
2006-02-03 18:19 ` [Bug middle-end/26092] [4.0/4.1/4.2 Regression] ICE on const function pointer assigned to a builtin function pinskia at gcc dot gnu dot org
2006-02-03 18:23 ` pinskia at gcc dot gnu dot org
2006-02-08 12:19 ` jakub at gcc dot gnu dot org
2006-02-13 21:28 ` jakub at gcc dot gnu dot org
2006-02-13 21:29 ` jakub at gcc dot gnu dot org
2006-02-13 21:42 ` [Bug middle-end/26092] [4.0 " pinskia at gcc dot gnu dot org
2006-02-27 20:29 ` mmitchel at gcc dot gnu dot org
2006-02-28 20:09 ` jakub at gcc dot gnu dot org
2006-02-28 22:20 ` pinskia at gcc dot gnu dot 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).