Skip to content

Crash in Sema with non-constant offsetof #3768

@efriedma-quic

Description

@efriedma-quic
Bugzilla Link 3396
Resolution FIXED
Resolved on Mar 12, 2010 00:57
Version unspecified
OS Linux

Extended Description

Testcase:

struct sockaddr_un {
unsigned char sun_len;
char sun_path[104];
};
int a() {
int a[__builtin_offsetof(struct sockaddr_un, sun_path[len+1])];
}

Crashes with the following message:
clang: /home/eli/llvm/tools/clang/lib/CodeGen/../../include/clang/AST/Expr.h:169: llvm::APSInt clang::Expr::getIntegerConstantExprValue(clang::ASTContext&) const: Assertion `success && "Illegal argument to getIntegerConstantExpr"' failed.

Note that non-constant offsetof is a gcc extension.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions