pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/47906: lang/g95: SEGV occurs when stack address is not aligned 8 bytes at main().



The following reply was made to PR pkg/47906; it has been noted by GNATS.

From: NONAKA Kimihiro <nonakap%gmail.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: wennmach%netbsd.org@localhost, gnats-admin%netbsd.org@localhost, 
pkgsrc-bugs%netbsd.org@localhost
Subject: Re: pkg/47906: lang/g95: SEGV occurs when stack address is not
 aligned 8 bytes at main().
Date: Tue, 9 Jul 2013 21:46:03 +0900

 Hi,
 
 2013/7/9 Joerg Sonnenberger <joerg%britannica.bec.de@localhost>:
 
 >  > >Description:
 >  > If the stack address is not aligned on 8 bytes, it is adjusted to 8 bytes 
 > aligned at main().
 >  > If stack address is adjusted, to get from the stack address the wrong 
 > return address, SEGV occurs.
 >
 >  What happens if the whole section is dropped, i.e. the stack pointer
 >  isn't adjusted in main at all? It shouldn't be needed at nothing on x86
 >  requires 64bit alignment.
 
 for speed.
 
 g95-0.93/libf95.a-0.93/runtime/main.c:
 
  46 int main(int argc, char *argv[]) {
  47
  48 /* Sometimes on x86, the stack isn't aligned to an 8-byte boundary,
  49  * which kills performance associated with doubles.  Align if
  50  * unaligned. */
  51
  52 #if HAVE_REAL_10 == 1 || HAVE_REAL_10 == 2
  53     asm("mov %%esp, %%eax\n"
  54         "and $0x04, %%eax\n"
  55         "sub %%eax, %%esp\n" : : : "%eax");
  56 #endif
 
 Regards,
 --
 NONAKA Kimihiro
 


Home | Main Index | Thread Index | Old Index