Clang 3.6 fails with -g due to .file directive order
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.
Trac metadata
Trac field | Value |
---|---|
Version | 7.10.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |