public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/40502] New: crash in cp_diagnostic_starter
@ 2009-06-20 12:33 dcb314 at hotmail dot com
2009-06-20 12:34 ` [Bug c++/40502] " dcb314 at hotmail dot com
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: dcb314 at hotmail dot com @ 2009-06-20 12:33 UTC (permalink / raw)
To: gcc-bugs
I just tried to compile the Suse Linux package libmodplug-0.8.7-1.5
with the G++ compiler version 4.5 snapshot 20090618.
The compiler said
In file included from /usr/include/string.h:428:0,
from load_pat.cpp:33:
In function 'char* strncpy(char*, const char*, size_t)'
/usr/include/bits/string3.h: In function 'void
_ZL19pat_read_waveheaderP8_IO_FILEP10WaveHeaderi.clone.1(FILE*, WaveHeader*)':
/usr/include/bits/string3.h:122:71: 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.
Preprocessed source attached. Flag -O2 required.
Here is valgrind helping out with a stack backtrace.
==32091== Invalid read of size 2
==32091== at 0x53989D: cp_diagnostic_starter (error.c:2581)
==32091== Address 0x0 is not stack'd, malloc'd or (recently) free'd
--
Summary: crash in cp_diagnostic_starter
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dcb314 at hotmail dot com
GCC host triplet: x86_64-suse-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40502
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/40502] crash in cp_diagnostic_starter
2009-06-20 12:33 [Bug c++/40502] New: crash in cp_diagnostic_starter dcb314 at hotmail dot com
@ 2009-06-20 12:34 ` dcb314 at hotmail dot com
2009-06-20 13:07 ` [Bug middle-end/40502] [4.5 Regression] " rguenth at gcc dot gnu dot org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: dcb314 at hotmail dot com @ 2009-06-20 12:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from dcb314 at hotmail dot com 2009-06-20 12:34 -------
Created an attachment (id=18031)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18031&action=view)
C++ source code
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40502
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/40502] [4.5 Regression] crash in cp_diagnostic_starter
2009-06-20 12:33 [Bug c++/40502] New: crash in cp_diagnostic_starter dcb314 at hotmail dot com
2009-06-20 12:34 ` [Bug c++/40502] " dcb314 at hotmail dot com
@ 2009-06-20 13:07 ` rguenth at gcc dot gnu dot org
2009-06-22 5:33 ` pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-20 13:07 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rguenth at gcc dot gnu dot org 2009-06-20 13:07 -------
#0 0x08214f03 in cp_print_error_function (context=0x8f14440,
diagnostic=0xbfffd530) at /home/richard/src/trunk/gcc/cp/error.c:2607
2607 if (TREE_CODE (block) == FUNCTION_DECL)
(gdb) l
2602 else
2603 {
2604 while (block && TREE_CODE (block) == BLOCK)
2605 block = BLOCK_SUPERCONTEXT (block);
2606
2607 if (TREE_CODE (block) == FUNCTION_DECL)
2608 fndecl = block;
block is NULL.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Component|c++ |middle-end
Ever Confirmed|0 |1
Keywords| |ice-on-valid-code
Last reconfirmed|0000-00-00 00:00:00 |2009-06-20 13:07:15
date| |
Summary|crash in |[4.5 Regression] crash in
|cp_diagnostic_starter |cp_diagnostic_starter
Target Milestone|--- |4.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40502
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/40502] [4.5 Regression] crash in cp_diagnostic_starter
2009-06-20 12:33 [Bug c++/40502] New: crash in cp_diagnostic_starter dcb314 at hotmail dot com
2009-06-20 12:34 ` [Bug c++/40502] " dcb314 at hotmail dot com
2009-06-20 13:07 ` [Bug middle-end/40502] [4.5 Regression] " rguenth at gcc dot gnu dot org
@ 2009-06-22 5:33 ` pinskia at gcc dot gnu dot org
2009-06-22 5:34 ` 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 @ 2009-06-22 5:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2009-06-22 05:33 -------
This is because __artificial__ is not being treated as it should be.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
GCC host triplet|x86_64-suse-linux |
GCC target triplet| |x86_64-suse-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40502
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/40502] [4.5 Regression] crash in cp_diagnostic_starter
2009-06-20 12:33 [Bug c++/40502] New: crash in cp_diagnostic_starter dcb314 at hotmail dot com
` (2 preceding siblings ...)
2009-06-22 5:33 ` pinskia at gcc dot gnu dot org
@ 2009-06-22 5:34 ` pinskia at gcc dot gnu dot org
2009-06-27 20:07 ` reichelt 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 @ 2009-06-22 5:34 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 515 bytes --]
------- Comment #4 from pinskia at gcc dot gnu dot org 2009-06-22 05:34 -------
as witness from:
In function char* strncpy(char*, const char*, size_t),
inlined from void pat_read_waveheader(FILE*, WaveHeader*, int) at
t.cc:7132:40:
t.cc:1965:94: warning: call to char* __builtin___strncpy_chk(char*, const
char*, long unsigned int, long unsigned int) will always overflow destination
buffer
If I add an obvious check for block being NULL.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40502
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/40502] [4.5 Regression] crash in cp_diagnostic_starter
2009-06-20 12:33 [Bug c++/40502] New: crash in cp_diagnostic_starter dcb314 at hotmail dot com
` (3 preceding siblings ...)
2009-06-22 5:34 ` pinskia at gcc dot gnu dot org
@ 2009-06-27 20:07 ` reichelt at gcc dot gnu dot org
2009-07-09 15:42 ` rguenth at gcc dot gnu dot org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2009-06-27 20:07 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from reichelt at gcc dot gnu dot org 2009-06-27 20:07 -------
Reduced testcase:
===============================================================
struct A
{
char x[12], y[35];
};
struct B
{
char z[50];
};
inline void foo(char* dest, const char* __restrict src, __SIZE_TYPE__ n)
{
__builtin___strncpy_chk (dest, src, n, 0);
}
void bar(const char*, int);
inline void baz(int i)
{
char s[128], t[32];
bar(s, 0);
bar(t, i);
A a;
B b;
foo(a.y, b.z, 36);
}
void quus()
{
baz(0);
}
===============================================================
--
reichelt at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |reichelt at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40502
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/40502] [4.5 Regression] crash in cp_diagnostic_starter
2009-06-20 12:33 [Bug c++/40502] New: crash in cp_diagnostic_starter dcb314 at hotmail dot com
` (4 preceding siblings ...)
2009-06-27 20:07 ` reichelt at gcc dot gnu dot org
@ 2009-07-09 15:42 ` rguenth at gcc dot gnu dot org
2009-07-10 8:18 ` jakub at gcc dot gnu dot org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-07-09 15:42 UTC (permalink / raw)
To: gcc-bugs
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu dot org
Priority|P3 |P1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40502
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/40502] [4.5 Regression] crash in cp_diagnostic_starter
2009-06-20 12:33 [Bug c++/40502] New: crash in cp_diagnostic_starter dcb314 at hotmail dot com
` (5 preceding siblings ...)
2009-07-09 15:42 ` rguenth at gcc dot gnu dot org
@ 2009-07-10 8:18 ` jakub at gcc dot gnu dot org
2009-07-10 11:50 ` manu 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 @ 2009-07-10 8:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jakub at gcc dot gnu dot org 2009-07-10 08:17 -------
This is PR39214 in C++ copy of that stuff. Will test and commit as obvious.
--
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|2009-06-20 13:07:15 |2009-07-10 08:17:53
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40502
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/40502] [4.5 Regression] crash in cp_diagnostic_starter
2009-06-20 12:33 [Bug c++/40502] New: crash in cp_diagnostic_starter dcb314 at hotmail dot com
` (6 preceding siblings ...)
2009-07-10 8:18 ` jakub at gcc dot gnu dot org
@ 2009-07-10 11:50 ` manu at gcc dot gnu dot org
2009-07-10 11:57 ` jakub at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: manu at gcc dot gnu dot org @ 2009-07-10 11:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from manu at gcc dot gnu dot org 2009-07-10 11:50 -------
(In reply to comment #6)
> This is PR39214 in C++ copy of that stuff. Will test and commit as obvious.
>
Please, also add the testcase. Bonus points for factoring out the parts that
are shared between the C and C++ front-ends (In fact, I think I have seen this
piece of code in other parts of the compiler).
--
manu at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40502
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/40502] [4.5 Regression] crash in cp_diagnostic_starter
2009-06-20 12:33 [Bug c++/40502] New: crash in cp_diagnostic_starter dcb314 at hotmail dot com
` (7 preceding siblings ...)
2009-07-10 11:50 ` manu at gcc dot gnu dot org
@ 2009-07-10 11:57 ` jakub at gcc dot gnu dot org
2009-07-10 22:32 ` jakub at gcc dot gnu dot org
2009-07-10 22:37 ` jakub at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-07-10 11:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from jakub at gcc dot gnu dot org 2009-07-10 11:57 -------
Subject: Bug 40502
Author: jakub
Date: Fri Jul 10 11:56:55 2009
New Revision: 149470
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149470
Log:
PR c++/40502
* error.c (cp_print_error_function): Check for NULL block.
* g++.dg/ext/strncpy-chk1.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/ext/strncpy-chk1.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/error.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40502
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/40502] [4.5 Regression] crash in cp_diagnostic_starter
2009-06-20 12:33 [Bug c++/40502] New: crash in cp_diagnostic_starter dcb314 at hotmail dot com
` (8 preceding siblings ...)
2009-07-10 11:57 ` jakub at gcc dot gnu dot org
@ 2009-07-10 22:32 ` jakub at gcc dot gnu dot org
2009-07-10 22:37 ` jakub at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-07-10 22:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jakub at gcc dot gnu dot org 2009-07-10 22:31 -------
Subject: Bug 40502
Author: jakub
Date: Fri Jul 10 22:31:34 2009
New Revision: 149499
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149499
Log:
PR c++/40502
* error.c (cp_print_error_function): Check for NULL block.
* g++.dg/ext/strncpy-chk1.C: New test.
Added:
branches/gcc-4_4-branch/gcc/testsuite/g++.dg/ext/strncpy-chk1.C
Modified:
branches/gcc-4_4-branch/gcc/cp/ChangeLog
branches/gcc-4_4-branch/gcc/cp/error.c
branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40502
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/40502] [4.5 Regression] crash in cp_diagnostic_starter
2009-06-20 12:33 [Bug c++/40502] New: crash in cp_diagnostic_starter dcb314 at hotmail dot com
` (9 preceding siblings ...)
2009-07-10 22:32 ` jakub at gcc dot gnu dot org
@ 2009-07-10 22:37 ` jakub at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-07-10 22:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from jakub at gcc dot gnu dot org 2009-07-10 22:37 -------
Fixed.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40502
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2009-07-10 22:37 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-20 12:33 [Bug c++/40502] New: crash in cp_diagnostic_starter dcb314 at hotmail dot com
2009-06-20 12:34 ` [Bug c++/40502] " dcb314 at hotmail dot com
2009-06-20 13:07 ` [Bug middle-end/40502] [4.5 Regression] " rguenth at gcc dot gnu dot org
2009-06-22 5:33 ` pinskia at gcc dot gnu dot org
2009-06-22 5:34 ` pinskia at gcc dot gnu dot org
2009-06-27 20:07 ` reichelt at gcc dot gnu dot org
2009-07-09 15:42 ` rguenth at gcc dot gnu dot org
2009-07-10 8:18 ` jakub at gcc dot gnu dot org
2009-07-10 11:50 ` manu at gcc dot gnu dot org
2009-07-10 11:57 ` jakub at gcc dot gnu dot org
2009-07-10 22:32 ` jakub at gcc dot gnu dot org
2009-07-10 22:37 ` jakub 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).