[GHC] #10667: '-g' option generates invalid assembly when '*/*' operator is used
#10667: '-g' option generates invalid assembly when '*/*' operator is used -------------------------------------+------------------------------------- Reporter: slyfox | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2-rc2 (CodeGen) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Compile-time Unknown/Multiple | crash Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | -------------------------------------+------------------------------------- Bug is observed when building cpphs-1.19 {{{#!hs module A where x */* y = 42 }}} {{{ $ ghc -fforce-recomp A -g [1 of 1] Compiling A ( A.hs, A.o ) /tmp/ghc23923_0/ghc_2.s: Assembler messages: /tmp/ghc23923_0/ghc_2.s:17:0: Error: bad expression /tmp/ghc23923_0/ghc_2.s:17:0: Warning: missing operand; zero assumed ... }}} The problem here is the following assembly snippet: {{{ .text .align 8 .loc 1 3 1 /* */* */ .quad 12884901911 .quad 0 .quad 15 }}} Would it be worthwile using ';' as a comment instead? Don't know if it's universally portable. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10667> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10667: '-g' option generates invalid assembly when '*/*' operator is used -------------------------------------+------------------------------------- Reporter: slyfox | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2-rc2 (CodeGen) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by scpmw): Well spotted - should have seen that one coming. Here's what the GNU assembler documentation says: The line comment character is target specific, and some targets multiple comment characters. Some targets also have line comment characters that only work if they are the first character on a line. Some targets use a sequence of two characters to introduce a line comment. Some targets can also change their line comment characters depending upon command line options that have been used. According to the same documentation, the line comment character for x86 is apparently `#`, while it's `@` for ARM. So possible, but a bit messy. I think the better course of action here would be to just "escape" the name - or maybe just drop the comment in the first place if the name looks problematic. It's not really that useful anyway. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10667#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10667: '-g' option generates invalid assembly when '*/*' operator is used -------------------------------------+------------------------------------- Reporter: slyfox | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2-rc2 (CodeGen) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by akio): * cc: akio (added) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10667#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10667: '-g' option generates invalid assembly when '*/*' operator is used -------------------------------------+------------------------------------- Reporter: slyfox | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2-rc2 (CodeGen) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by mjmrotek): Similar thing happens when compiling HMatrix with -g: {{{ [16 of 33] Compiling Numeric.LinearAlgebra.Algorithms ( src/Numeric/LinearAlgebra/Algorithms.hs, .stack- work/dist/x86_64-linux/Cabal-1.22.4.0/build/Numeric/LinearAlgebra/Algorithms.o ) /tmp/ghc31909_0/ghc_110.s: Assembler messages: /tmp/ghc31909_0/ghc_110.s:60657:0: Error: bad expression /tmp/ghc31909_0/ghc_110.s:60664:0: Error: bad expression ... etc }}} and in the offending .s file: {{{ 60657: .loc 3 805 33 /* expGolub.*/ */ 60664: .loc 3 805 33 /* expGolub.*/ */ ... etc }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10667#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10667: '-g' option generates invalid assembly when '*/*' operator is used -------------------------------------+------------------------------------- Reporter: slyfox | Owner: Type: bug | Status: patch Priority: normal | Milestone: 7.10.3 Component: Compiler | Version: 7.10.2-rc2 (CodeGen) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1386 Wiki Page: | -------------------------------------+------------------------------------- Changes (by slyfox): * status: new => patch * differential: => Phab:D1386 * architecture: Unknown/Multiple => x86_64 (amd64) * milestone: => 7.10.3 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10667#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10667: '-g' option generates invalid assembly when '*/*' operator is used -------------------------------------+------------------------------------- Reporter: slyfox | Owner: Type: bug | Status: patch Priority: normal | Milestone: 7.10.3 Component: Compiler | Version: 7.10.2-rc2 (CodeGen) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1386 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Sergei Trofimovich <siarheit@…>): In [changeset:"e272ab99f60884e5c510c9597fbdb1a570eedcaa/ghc" e272ab9/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="e272ab99f60884e5c510c9597fbdb1a570eedcaa" x86 codegen: don't generate location comments The following source snippet 'module A where x */* y = 42' when being compiled with '-g' option emits syntactically invalid comment for GNU as: .text .align 8 .loc 1 3 1 /* */* */ Fixed by not emitting comments at all. We already suppress all asm comments in 'X86/Ppr.hs'. Signed-off-by: Sergei Trofimovich <siarheit@google.com> Test Plan: added test and check it works Reviewers: scpmw, simonmar, austin, bgamari Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1386 GHC Trac Issues: #10667 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10667#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10667: '-g' option generates invalid assembly when '*/*' operator is used -------------------------------------+------------------------------------- Reporter: slyfox | Owner: Type: bug | Status: merge Priority: normal | Milestone: 7.10.3 Component: Compiler | Version: 7.10.2-rc2 (CodeGen) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1386 Wiki Page: | -------------------------------------+------------------------------------- Changes (by slyfox): * status: patch => merge -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10667#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10667: '-g' option generates invalid assembly when '*/*' operator is used -------------------------------------+------------------------------------- Reporter: slyfox | Owner: Type: bug | Status: closed Priority: normal | Milestone: 7.10.3 Component: Compiler | Version: 7.10.2-rc2 (CodeGen) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1386 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10667#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC