From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12448 invoked by alias); 4 Jan 2014 04:14:47 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 12421 invoked by uid 48); 4 Jan 2014 04:14:42 -0000 From: "christos at zoulas dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/59674] New: On m68k and vax variables stack variables with > MAX_STACK_ALIGNMENT make ssp fail Date: Sat, 04 Jan 2014 04:14:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: christos at zoulas dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-01/txt/msg00171.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59674 Bug ID: 59674 Summary: On m68k and vax variables stack variables with > MAX_STACK_ALIGNMENT make ssp fail Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: christos at zoulas dot com Thie simple example: struct foo { const char *place; long long time; }; extern int goo(struct foo *); int foo(void); int foo(void) { struct foo f; f.time = 1; f.place = "foo"; return goo(&f); } When compiled, produces: /usr/obj/x86_64/tools/bin/m68k--netbsdelf-gcc -Os -fstack-protector -Wstack-protector --param ssp-buffer-size=1 -c foo.c foo.c: In function 'foo': foo.c:9:5: warning: stack protector not protecting local variables: variable length buffer [-Wstack-protector] There are no variable length buffers on the stack. The problem is that we end up calling in cfgexpand.c: /* If there were any, allocate space. */ if (large_size > 0) large_base = allocate_dynamic_stack_space (GEN_INT (large_size), 0, large_align, true); Changing long long to int, works just fine. It is a serious limitation not to be able to protect stacks that contain long long or double. Here's the gcc version: $ /usr/obj/x86_64/tools/bin/m68k--netbsdelf-gcc -v Using built-in specs. COLLECT_GCC=/usr/obj/x86_64/tools/bin/m68k--netbsdelf-gcc COLLECT_LTO_WRAPPER=/usr/obj/x86_64/tools/libexec/gcc/m68k--netbsdelf/4.8.3/lto-wrapper Target: m68k--netbsdelf Configured with: /p/netbsd/cvsroot/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=m68k--netbsdelf --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb1 20120916' --with-system-zlib --enable-__cxa_atexit --with-sysroot=/usr/obj/sun3/release --with-mpc=/usr/obj/x86_64/tools --with-mpfr=/usr/obj/x86_64/tools --with-gmp=/usr/obj/x86_64/tools --disable-nls --disable-multilib --program-transform-name=s,^,m68k--netbsdelf-, --enable-languages='c c++ objc' --prefix=/usr/obj/x86_64/tools Thread model: posix gcc version 4.8.3 20131213 (prerelease) (NetBSD nb1 20120916)