[GHC] #10687: Clang 3.6 fails with -g due to .file directive order

GHC ghc-devs at haskell.org
Sat Jul 25 18:05:24 UTC 2015


#10687: Clang 3.6 fails with -g due to .file directive order
-------------------------------------+-------------------------------------
              Reporter:  scpmw       |             Owner:
                  Type:  bug         |            Status:  new
              Priority:  normal      |         Milestone:
             Component:  Compiler    |           Version:  7.10.1
              Keywords:              |  Operating System:  Unknown/Multiple
          Architecture:              |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
             Test Case:              |        Blocked By:
              Blocking:              |   Related Tickets:
Differential Revisions:              |
-------------------------------------+-------------------------------------
 On Mac Os X, compiling with `-g` will sometimes fail with an error like
 follows:

 {{{
 /var/folders/yt/bmbchswn57nbmz1l67btd6p00000gn/T/ghc27418_0/ghc_1.s:6573:7:
 error:
      error: unassigned file number in '.loc' directive
             .loc 7 106 17 /* cast */
                  ^
  }}}

 Which refers to the following code:
 {{{
 [...]
         .file 7 "libraries/base/Data/Typeable.hs"
         .file 6 "libraries/ghc-prim/GHC/Classes.hs"
 [...]
         .loc 7 106 17 /* cast */
 }}}

 So the file number is clearly assigned, we are just not assigning them "in
 order". This is okay for most compilers, but Clang 3.6 seems to disagree.
 The attached patch changes the code so `.file` directives are always
 generated in order.

 Could try to produce a testcase if required - it would be rather easy to
 check that `.file` directives appear in order in a given assembly file.

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


More information about the ghc-tickets mailing list