public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/10433: G++ crash using array pointer and sizeof as arguments to same function in template method
@ 2003-04-18 17:46 jrumsey
0 siblings, 0 replies; only message in thread
From: jrumsey @ 2003-04-18 17:46 UTC (permalink / raw)
To: gcc-gnats
>Number: 10433
>Category: c++
>Synopsis: G++ crash using array pointer and sizeof as arguments to same function in template method
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: ice-on-legal-code
>Submitter-Id: net
>Arrival-Date: Fri Apr 18 17:46:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: jrumsey@blizzard.com
>Release: gcc version 3.4 20030417 (experimental)
>Organization:
>Environment:
Mandrake 7.2 Linux, Kernel=2.4.18-6mdkenterprise #1 SMP
>Description:
This simple test case causes a segmentation fault in the compiler on the call to strfn(). Replacing the "query" argument with &query[0] causes it to work, as does replacing the "sizeof(query)" with a constant value, E.G. "1024". The same code in a non-template method also compiles correctly.
Command line and compiler output:
$ g++ -v -save-temps templatetest2.cpp -o templatetest2
Reading specs from /usr/unstable/lib/gcc-lib/i686-pc-linux-gnu/3.4/specs
Configured with: ../gcc/configure --prefix=/usr/unstable
Thread model: posix
gcc version 3.4 20030417 (experimental)
/usr/unstable/lib/gcc-lib/i686-pc-linux-gnu/3.4/cc1plus -E -quiet -v -D_GNU_SOURCE templatetest2.cpp templatetest2.ii
ignoring nonexistent directory "/usr/unstable/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/unstable/include/c++/3.4
/usr/unstable/include/c++/3.4/i686-pc-linux-gnu
/usr/unstable/include/c++/3.4/backward
/usr/local/include
/usr/unstable/include
/usr/unstable/lib/gcc-lib/i686-pc-linux-gnu/3.4/include
/usr/include
End of search list.
/usr/unstable/lib/gcc-lib/i686-pc-linux-gnu/3.4/cc1plus -fpreprocessed templatetest2.ii -quiet -dumpbase templatetest2.cpp -auxbase templatetest2 -version -o templatetest2.s
GNU C++ version 3.4 20030417 (experimental) (i686-pc-linux-gnu)
compiled by GNU C version 3.4 20030417 (experimental).
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=128638
templatetest2.cpp: In member function `void TClass<REC>::Load(const char*)':
templatetest2.cpp:12: internal compiler error: Segmentation fault
>How-To-Repeat:
Compile this preprocessed source
# 1 "templatetest2.cpp"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "templatetest2.cpp"
extern char *strfn(char *dest, const char *src, int destsize);
class Record {
};
template <class REC> class TClass {
public:
void Load(const char *filter) {
char query[1024];
strfn(query, "SQL QUERY", sizeof(query));
}
};
int main(int argc, char **argv)
{
TClass<Record> db;
return 0;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-04-18 17:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-18 17:46 c++/10433: G++ crash using array pointer and sizeof as arguments to same function in template method jrumsey
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).