Ticket #21032

Mac OS X 10.6.2 の GCCで -O3 コンパイルすると動作しない

Open Date: 2010-03-09 09:52 Last Update: 2010-03-10 20:17

Reporter:
Owner:
Type:
Status:
Closed
Component:
(None)
MileStone:
(None)
Priority:
1 - Lowest
Severity:
3
Resolution:
None
File:
None

Details

Mac OS X 10.6.2 環境下で、GCCの最適化オプションをつけてコンパイルすると実行時にエラーになる。

発生した環境では、GCC 4.2.1

なお、同一ソースでLinux (Fedora12)にて最適化コンパイル時には問題は発生しない。

確認したFedora12のGCCのバージョンは 4.4.3

Ticket History (3/6 Histories)

2010-03-09 09:52 Updated by: udawtr
  • New Ticket "Mac OS X 10.6.2 の GCCで -O3 コンパイルすると動作しない" created
2010-03-10 17:36 Updated by: (del#42321)
Comment

このパッチを適用するといかがでしょうか?

diff -cr magro-0.1.1.orig/src/mainapp/chain.c magro-0.1.1/src/mainapp/chain.c
*** magro-0.1.1.orig/src/mainapp/chain.c	2010-02-16 17:07:33.000000000 +0900
--- magro-0.1.1/src/mainapp/chain.c	2010-03-10 15:57:01.000000000 +0900
***************
*** 88,93 ****
--- 88,94 ----
              bugs_node_dump(g_bugsnode);
      
  		chain->_bugsnode = g_bugsnode;
+ 	return 0;
  	}
      else
      {
diff -cr magro-0.1.1.orig/src/parser_bugs/parser_bugs.c magro-0.1.1/src/parser_bugs/parser_bugs.c
*** magro-0.1.1.orig/src/parser_bugs/parser_bugs.c	2010-02-16 12:31:45.000000000 +0900
--- magro-0.1.1/src/parser_bugs/parser_bugs.c	2010-03-10 15:57:01.000000000 +0900
***************
*** 1264,1270 ****
    
    int yystate;
    int yyn;
!   int yyresult;
    /* Number of tokens to shift before error messages enabled.  */
    int yyerrstatus;
    /* Look-ahead token as an internal (translated) token number.  */
--- 1264,1270 ----
    
    int yystate;
    int yyn;
!   volatile int yyresult;
    /* Number of tokens to shift before error messages enabled.  */
    int yyerrstatus;
    /* Look-ahead token as an internal (translated) token number.  */

2010-03-10 20:16 Updated by: udawtr
  • Owner Update from (None) to udawtr
2010-03-10 20:16 Updated by: udawtr
  • Details Updated
2010-03-10 20:17 Updated by: udawtr
  • Status Update from Open to Closed
  • Ticket Close date is changed to 2010-03-10 20:17
Comment

itohi への返信 ご指摘の2箇所を修正しましたところ、Macでも最適化オプション付きで動作しました。 ありがとうございました。

2010-03-12 12:12 Updated by: (del#42321)
Comment

すみません。後の方のvolatileは不要でした。

Attachment File List

No attachments

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login