From 4f684ed6b96e64df16751b09ed0c09e46fe05ad6 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Tue, 4 Apr 2006 17:35:48 +0000 Subject: [PATCH] Test program which uses templates to generate very long stabs (debug info) strings. This crashes 3.1.1 when the test is compiled with -gstabs. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5826 --- memcheck/tests/Makefile.am | 5 +++ memcheck/tests/deep_templates.cpp | 49 ++++++++++++++++++++++++ memcheck/tests/deep_templates.stderr.exp | 0 memcheck/tests/deep_templates.stdout.exp | 1 + memcheck/tests/deep_templates.vgtest | 2 + 5 files changed, 57 insertions(+) create mode 100644 memcheck/tests/deep_templates.cpp create mode 100644 memcheck/tests/deep_templates.stderr.exp create mode 100644 memcheck/tests/deep_templates.stdout.exp create mode 100644 memcheck/tests/deep_templates.vgtest diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index b70686995c..28bf2d20b8 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -38,6 +38,8 @@ EXTRA_DIST = $(noinst_SCRIPTS) \ clientperm.stderr.exp \ clientperm.stdout.exp clientperm.vgtest \ custom_alloc.stderr.exp custom_alloc.vgtest \ + deep_templates.vgtest \ + deep_templates.stdout.exp deep_templates.stderr.exp \ describe-block.stderr.exp describe-block.vgtest \ doublefree.stderr.exp doublefree.vgtest \ erringfds.stderr.exp erringfds.stdout.exp erringfds.vgtest \ @@ -137,6 +139,7 @@ check_PROGRAMS = \ badaddrvalue badfree badjump badjump2 \ badloop badpoll badrw brk brk2 buflen_check \ clientperm custom_alloc \ + deep_templates \ describe-block \ doublefree error_counts errs1 exitprog execve execve2 erringfds \ fprw fwrite hello inits inline \ @@ -192,6 +195,8 @@ supp2_SOURCES = supp.c mismatches_SOURCES = mismatches.cpp new_nothrow_SOURCES = new_nothrow.cpp new_override_SOURCES = new_override.cpp +deep_templates_SOURCES = deep_templates.cpp +deep_templates_CXXFLAGS = $(AM_FLAG_M3264_PRI) $(AM_CFLAGS) -O -gstabs # Build shared object for wrap7 wrap7_SOURCES = wrap7.c diff --git a/memcheck/tests/deep_templates.cpp b/memcheck/tests/deep_templates.cpp new file mode 100644 index 0000000000..448bcb95fa --- /dev/null +++ b/memcheck/tests/deep_templates.cpp @@ -0,0 +1,49 @@ + +/* Point of this test is to generate some very long 'stabs' debug + strings, via the use of these exponentially large template types. + When compiled with -gstabs, this causes 3.1.1 to segfault at + startup. +*/ + +#include + +template +class Stack +{ + public: + Stack(int = 10) { size=5; top=6; stackPtr=(T*)6; }; + ~Stack() { } + int push(const T&, const U&); + int popT(T&); + int popU(U&); + int isEmpty() const { return top == -1; } + int isFull() const { return top == size - 1; } + private: + int size; + int top; + T* stackPtr; +} ; + +typedef Stack Foo; +typedef Stack Foo2; +typedef Stack Foo3; +typedef Stack Foo4; +typedef Stack Foo5; +typedef Stack Foo6; +typedef Stack Foo7; +typedef Stack Foo8; +typedef Stack Foo9; +typedef Stack Foo10; +typedef Stack Foo11; +typedef Stack Foo12; + +int main ( char* argc, char** argv ) +{ + Stack * x = new Stack(3); + if (x == NULL) + printf("It's NULL (?!)\n"); + else + printf("It's not NULL. How DULL.\n"); + delete x; + return 0; +} diff --git a/memcheck/tests/deep_templates.stderr.exp b/memcheck/tests/deep_templates.stderr.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/memcheck/tests/deep_templates.stdout.exp b/memcheck/tests/deep_templates.stdout.exp new file mode 100644 index 0000000000..33820a0c36 --- /dev/null +++ b/memcheck/tests/deep_templates.stdout.exp @@ -0,0 +1 @@ +It's not NULL. How DULL. diff --git a/memcheck/tests/deep_templates.vgtest b/memcheck/tests/deep_templates.vgtest new file mode 100644 index 0000000000..f243fe128c --- /dev/null +++ b/memcheck/tests/deep_templates.vgtest @@ -0,0 +1,2 @@ +prog: deep_templates +vgopts: -q -- 2.47.2