Skip to content

-ffreestanding no longer recognizes auto-returns_twice #11668

@jsonn

Description

@jsonn
Bugzilla Link 11296
Resolution WONTFIX
Resolved on Feb 04, 2014 13:49
Version trunk
OS Linux
CC @DimitryAndric,@efriedma-quic

Extended Description

Recently, the name matching in LLVM for functions like setjmp, savectx etc was removed and replaced by corresponding builtins in the C frontend.

Consequence 1: Functions need a proper, consistent prototype for this to work. This is not the case for savectx, which depending on the architecture and BSD returns either void or int. It is also used only in kernel and returns_twice semantic seems to only apply for FreeBSD.

Consequence 2: Since the kernel and modules are built with -ffreestanding, they no longer provides the returns_twice attribute for them. Compile the attached test case with and without -ffreestanding and compare IR:

w/ -ffreestanding:

declare i32 @​savectx(%struct.__jmp_buf_tag*)

w/o -ffreestanding:

declare i32 @​savectx(%struct.__jmp_buf_tag*) returns_twice

This bug is about tracking this change. I do not consider (2) a regression by itself, but it might be nice to detect and warn for this case specifically. The old behavior is certainly wrong and hides the real issue.

Based on (2), I would like to see savectx dropped from the list. It is non-standard and inconsistently defined and the only users don't benefit from the behavior anyway. For FreeBSD it should be trivial to add the attributes for the ports that need it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang:frontendLanguage frontend issues, e.g. anything involving "Sema"wontfixIssue is real, but we can't or won't fix it. Not invalid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions