The following (admittedly ugly) piece of code works on older gccs, and
segfaults on 4.3:
#include <assert.h>
#include <string.h>
static void something();
int main(int argc, char **argv) {
something("test");
}
static void something(const char *whatever) {
assert(!strcmp(whatever, "test"));
}
Changing the initial declaration of something() to static void something(char
*whatever) makes the problem go away.
--
Summary: [4.3 regression] calling a function with undefined
parameters causes segmentation fault at -O1 or higher
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bero at arklinux dot org
GCC build triplet: i586-pc-linux-gnu
GCC host triplet: i586-pc-linux-gnu
GCC target triplet: i586-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34982