This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/59674] New: On m68k and vax variables stack variables with > MAX_STACK_ALIGNMENT make ssp fail


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]