[LLVMbugs] [Bug 11264] New: Duplicate strings

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


           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() {

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"
    .globl    gp2
    .align    16, 0x90
    .type    gp2, at function
gp2:                                    # @gp2
# BB#0:                                 # %entry
    pushq    %rbp
    .cfi_def_cfa_offset 16
    .cfi_offset %rbp, -16
    movq    %rsp, %rbp
    .cfi_def_cfa_register %rbp
    movl    $str, %edi
    callq    puts
    movl    $str1, %edi
    popq    %rbp
    jmp    puts                    # TAILCALL
    .size    gp2, .Ltmp6-gp2

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

    .type    str1, at object            # @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