Skip to content

Failed to emit string literals ends with '\0' #975

Closed
@ChuanqiXu9

Description

@ChuanqiXu9

Reproducer:

// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t.ll
// RUN: FileCheck --input-file=%t.ll %s -check-prefix=LLVM

void f(char *fmt, ...);
void test() {
    f("test\0");
}

got:

loc("/disk2/workspace.xuchuanqi/clangir/clang/test/CIR/Lowering/str.c":6:7): error: 'llvm.mlir.global' op requires an i8 array type of the length equal to that of the string attribute

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions