[LLVMbugs] [Bug 11296] New: -ffreestanding no longer recognizes auto-returns_twice

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Nov 2 08:00:36 PDT 2011


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

             Bug #: 11296
           Summary: -ffreestanding no longer recognizes auto-returns_twice
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: rafael.espindola at gmail.com
        ReportedBy: joerg at NetBSD.org
                CC: llvmbugs at cs.uiuc.edu, rdivacky at freebsd.org
    Classification: Unclassified


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.

-- 
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