[GHC] #10560: -f and -O options interact in non-obvious, order dependent ways

GHC ghc-devs at haskell.org
Mon Jun 22 18:36:45 UTC 2015


#10560: -f and -O options interact in non-obvious, order dependent ways
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.10.1
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  warning at compile-time            |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by thomie):

 `gcc` does not care whether you put the `-fno` flag before or after the
 `-Ox` flag.

 {{{
 $ gcc --version
 gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
 }}}

 {{{
 $ cat test.c
 int factorial(int x) {
    if (x > 1) return x * factorial(x-1);
       else return 1;
 }
 }}}

 {{{
 $ gcc test.c -S && grep call test.s
         call    factorial

 $ gcc test.c -S -O2 && grep call test.s

 $ gcc test.c -S -O2 -fno-optimize-sibling-calls && grep call test.s
         call    factorial

 $ gcc test.c -S -fno-optimize-sibling-calls -O2 && grep call test.s
         call    factorial
 }}}

 This seems right to me. Sven, don't you think it would be least confusing
 to users if we followed `gcc` on this one.


 To George:
 {{{
 ghc -fspecialise -fno-specialise <filename>.hs
 ghc -fno-specialise -fspecialise <filename>.hs
 }}}
 Please open a separate ticket if you want a warning for these. It's
 related to this ticket, but I think separating these will benefit the
 discussion here.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10560#comment:14>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list