public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/59674] New: On m68k and vax variables stack variables with > MAX_STACK_ALIGNMENT make ssp fail
@ 2014-01-04  4:14 christos at zoulas dot com
  2014-01-04 11:20 ` [Bug c/59674] " mikpelinux at gmail dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: christos at zoulas dot com @ 2014-01-04  4:14 UTC (permalink / raw)
  To: gcc-bugs

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)


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-01-16 20:04 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-04  4:14 [Bug c/59674] New: On m68k and vax variables stack variables with > MAX_STACK_ALIGNMENT make ssp fail christos at zoulas dot com
2014-01-04 11:20 ` [Bug c/59674] " mikpelinux at gmail dot com
2014-01-04 17:22 ` mikpelinux at gmail dot com
2014-01-04 19:31 ` christos at zoulas dot com
2014-01-04 20:42 ` mikpelinux at gmail dot com
2014-01-04 21:21 ` christos at zoulas dot com
2014-01-04 21:49 ` schwab@linux-m68k.org
2014-01-23 17:12 ` martin at netbsd dot org
2014-01-24 21:37 ` [Bug target/59674] " schwab@linux-m68k.org
2015-01-16 18:56 ` law at redhat dot com
2015-01-16 20:04 ` law at redhat dot com

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).