public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/40837]  New: trampolines not working on x86-64 windows vista
@ 2009-07-23 10:44 charlet at gcc dot gnu dot org
  2009-07-23 11:11 ` [Bug target/40837] " sezeroz at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: charlet at gcc dot gnu dot org @ 2009-07-23 10:44 UTC (permalink / raw)
  To: gcc-bugs

The following C program should print "369", and return a zero exit status.
It does not work on 64-bit Windows Vista.  Instead, it crashes before
the printf, and returns exit status 5.  This is, I assume, because
trampolines do not work.  I guess the protection bits for stack pages need
to be set to allow "execute" when trampolines are present.

The program works on x86-64 linux.

Compiled with "gcc trampoline.c".

Note that this is not legal C code.  It uses the gcc-specific nested-function
extension.

#include <stdio.h>
#include <assert.h>

int f (void (*action) (void))
{   
    (*action)();
}

int g (void)
{   
    int local = 123;

    void nested (void)
    {   
        local = local + 246;
    }

    f (&nested);
    printf ("%d\n", local);

    assert (local == 369);
}

int main (void)
{   
    g();
    return (0);
}


-- 
           Summary: trampolines not working on x86-64 windows vista
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: charlet at gcc dot gnu dot org
  GCC host triplet: x86_64-pc-mingw32


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40837


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

* [Bug target/40837] trampolines not working on x86-64 windows vista
  2009-07-23 10:44 [Bug target/40837] New: trampolines not working on x86-64 windows vista charlet at gcc dot gnu dot org
@ 2009-07-23 11:11 ` sezeroz at gmail dot com
  2009-07-23 12:20 ` charlet at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: sezeroz at gmail dot com @ 2009-07-23 11:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from sezeroz at gmail dot com  2009-07-23 11:10 -------
Curious.  As a data point, can't reproduce this with 4.4 (svn rev.149965).


-- 

sezeroz at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sezeroz at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40837


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

* [Bug target/40837] trampolines not working on x86-64 windows vista
  2009-07-23 10:44 [Bug target/40837] New: trampolines not working on x86-64 windows vista charlet at gcc dot gnu dot org
  2009-07-23 11:11 ` [Bug target/40837] " sezeroz at gmail dot com
@ 2009-07-23 12:20 ` charlet at gcc dot gnu dot org
  2009-07-23 12:40 ` sezeroz at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: charlet at gcc dot gnu dot org @ 2009-07-23 12:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from charlet at gcc dot gnu dot org  2009-07-23 12:20 -------
Are you using a 64 bit compiler?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40837


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

* [Bug target/40837] trampolines not working on x86-64 windows vista
  2009-07-23 10:44 [Bug target/40837] New: trampolines not working on x86-64 windows vista charlet at gcc dot gnu dot org
  2009-07-23 11:11 ` [Bug target/40837] " sezeroz at gmail dot com
  2009-07-23 12:20 ` charlet at gcc dot gnu dot org
@ 2009-07-23 12:40 ` sezeroz at gmail dot com
  2009-07-23 13:10 ` charlet at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: sezeroz at gmail dot com @ 2009-07-23 12:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from sezeroz at gmail dot com  2009-07-23 12:40 -------
I cross-compile from i686-linux to x86_64-pc-mingw32.  (I can also try
cross-compiling from x86_64-linux to x86_64-pc-mingw32, if you want.)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40837


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

* [Bug target/40837] trampolines not working on x86-64 windows vista
  2009-07-23 10:44 [Bug target/40837] New: trampolines not working on x86-64 windows vista charlet at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-07-23 12:40 ` sezeroz at gmail dot com
@ 2009-07-23 13:10 ` charlet at gcc dot gnu dot org
  2009-07-23 13:46 ` sezeroz at gmail dot com
  2009-07-23 15:03 ` charlet at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: charlet at gcc dot gnu dot org @ 2009-07-23 13:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from charlet at gcc dot gnu dot org  2009-07-23 13:10 -------
Interesting, thanks for the feedback. Let me double check a few things on
my side (testing various GCC versions).

Arno


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40837


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

* [Bug target/40837] trampolines not working on x86-64 windows vista
  2009-07-23 10:44 [Bug target/40837] New: trampolines not working on x86-64 windows vista charlet at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2009-07-23 13:10 ` charlet at gcc dot gnu dot org
@ 2009-07-23 13:46 ` sezeroz at gmail dot com
  2009-07-23 15:03 ` charlet at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: sezeroz at gmail dot com @ 2009-07-23 13:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from sezeroz at gmail dot com  2009-07-23 13:46 -------
Compiled my same toolchain on linux-x86_64 and compiled the test for
x86_64-pc-mingw32, the resulting exe prints 369 on Vista-SP2-x64 and exits
normally.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40837


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

* [Bug target/40837] trampolines not working on x86-64 windows vista
  2009-07-23 10:44 [Bug target/40837] New: trampolines not working on x86-64 windows vista charlet at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2009-07-23 13:46 ` sezeroz at gmail dot com
@ 2009-07-23 15:03 ` charlet at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: charlet at gcc dot gnu dot org @ 2009-07-23 15:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from charlet at gcc dot gnu dot org  2009-07-23 15:02 -------
My confusion: I thought I had tested with GCC 4.5 but in fact I had used
GCC 4.3 which does not have the 'MINGW_ENABLE_EXECUTE_STACK' macro (and
__enable_execute_stack symbol).

Arno


-- 

charlet at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.4.0
            Version|4.5.0                       |4.3.4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40837


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

end of thread, other threads:[~2009-07-23 15:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-23 10:44 [Bug target/40837] New: trampolines not working on x86-64 windows vista charlet at gcc dot gnu dot org
2009-07-23 11:11 ` [Bug target/40837] " sezeroz at gmail dot com
2009-07-23 12:20 ` charlet at gcc dot gnu dot org
2009-07-23 12:40 ` sezeroz at gmail dot com
2009-07-23 13:10 ` charlet at gcc dot gnu dot org
2009-07-23 13:46 ` sezeroz at gmail dot com
2009-07-23 15:03 ` charlet at gcc dot gnu dot org

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