[LLVMbugs] [Bug 11264] New: Duplicate strings

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Oct 28 19:59:04 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=11264

           Summary: Duplicate strings
           Product: clang
           Version: 2.9
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: rkotler at mips.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


In a simple program with duplicate strings in printf, clang creates two
identical string constants:

#include <stdio.h>

void gp2() {
  printf("hello\n");
  printf("hello\n");
}

The bitcode file has two different string constants.

The x86 code generator removes the duplicate but in both Arm and Mips the
duplicate is preserved.


    .file    "gp2.c"
    .text
    .globl    gp2
    .align    16, 0x90
    .type    gp2, at function
gp2:                                    # @gp2
.Ltmp2:
    .cfi_startproc
# BB#0:                                 # %entry
    pushq    %rbp
.Ltmp3:
    .cfi_def_cfa_offset 16
.Ltmp4:
    .cfi_offset %rbp, -16
    movq    %rsp, %rbp
.Ltmp5:
    .cfi_def_cfa_register %rbp
    movl    $str, %edi
    callq    puts
    movl    $str1, %edi
    popq    %rbp
    jmp    puts                    # TAILCALL
.Ltmp6:
    .size    gp2, .Ltmp6-gp2
.Ltmp7:
    .cfi_endproc
.Leh_func_end0:

    .type    str, at object             # @str
    .section    .rodata,"a", at progbits
str:
    .asciz     "hello"
    .size    str, 6

    .type    str1, at object            # @str1
str1:
    .asciz     "hello"
    .size    str1, 6


    .section    ".note.GNU-stack","", at progbits

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list