[GHC] #12965: String merging broken on Windows

GHC ghc-devs at haskell.org
Mon Dec 12 17:21:12 UTC 2016


#12965: String merging broken on Windows
----------------------------------------+---------------------------------
           Reporter:  bgamari           |             Owner:
               Type:  bug               |            Status:  new
           Priority:  normal            |         Milestone:  8.2.1
          Component:  Compiler          |           Version:  8.0.1
           Keywords:                    |  Operating System:  Windows
       Architecture:  Unknown/Multiple  |   Type of failure:  None/Unknown
          Test Case:                    |        Blocked By:
           Blocking:                    |   Related Tickets:
Differential Rev(s):                    |         Wiki Page:
----------------------------------------+---------------------------------
 #9577 introduced string literal merging via the linker. Unfortunately I
 haven't been able to get this to function on Windows, resulting in
 testsuite failures of #9577.

 Even `gcc` appears to do the wrong thing here,
 {{{
 $ cat hi.c
 #include <stdio.h>
 const char *hi = "hello world";
 extern const char *hi2;
 void main() {
     printf("%p %p", hi, hi2);
 }
 $ cat hi2.c
 const char *hi2 = "hello world";
 $ gcc -c hi.c; gcc -c hi2.c; gcc -fmerge-all-constants hi2.o hi.o
 $ ./a.exe
 0x100403040 0x100403030
 $ gcc -s hi2.c
 $ cat hi2.s
         .file   "hi2.c"
         .globl  hi
         .section .rdata,"dr"
 .LC0:
         .ascii "hello world\0"
         .data
         .align 8
 hi:
         .quad   .LC0
         .ident  "GCC: (GNU) 5.3.0"
 }}}

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


More information about the ghc-tickets mailing list