Bug 1188075

Summary: Clang fails to compile C++11 programs with _FORTIFY_SOURCE when using the standard library
Product: [Fedora] Fedora Reporter: Bastiaan Jacques <bastiaan>
Component: llvmAssignee: Adam Jackson <ajax>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 21CC: ajax, bos, dgunchev, dmalcolm, hugh.m.bright, jv+fedora, kwizart, lersek, petersen, scottt.tw
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-02 08:25:06 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Bastiaan Jacques 2015-02-02 00:36:55 UTC
Description of problem:

The clang compiler fails to compile C++11 programs 

Version-Release number of selected component (if applicable):

clang-3.5.0-6.fc21.x86_64
llvm-3.5.0-6.fc21.x86_64

How reproducible:

Every time.

Steps to Reproduce:

1. Testcase clang.cc:
#include <memory>

int main() {}

2. Compile with clang++ -o clang clang.cc -std=c++11 -O2 -D_FORTIFY_SOURCE=2.

It does not matter whether c++11 or c++0x are used, but the problem does not happen if you omit _FORTIFY_SOURCE (or set it to 0) or disable optimization.

Actual results:

In file included from clang.cc:1:
In file included from /bin/../lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/memory:72:
In file included from /bin/../lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/iosfwd:40:
In file included from /bin/../lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/bits/postypes.h:40:
In file included from /bin/../lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/cwchar:44:
In file included from /usr/include/wchar.h:884:
/usr/include/bits/wchar2.h:291:14: error: use of undeclared identifier '__builtin_va_arg_pack'
                           __fmt, __va_arg_pack ());
                                  ^
/usr/include/sys/cdefs.h:349:26: note: expanded from macro '__va_arg_pack'
# define __va_arg_pack() __builtin_va_arg_pack ()
                         ^

[output continues]

Expected results:

No output, return code 0.

Comment 1 Don Bright 2015-06-06 18:05:56 UTC
confirmed on Fedora 22. same error.

Comment 2 Doncho Gunchev 2015-08-07 08:21:39 UTC
Also:
/usr/include/bits/stdio2.h:195:11: error: use of undeclared identifier '__builtin_va_arg_pack', Fedora 22

Comment 3 Laszlo Ersek 2015-10-27 23:16:01 UTC
_FORTIFY_SOURCE cannot be used with clang + glibc.

Code gets miscompiled:
https://llvm.org/bugs/show_bug.cgi?id=16821

It is an unsupported configuration:
https://llvm.org/bugs/show_bug.cgi?id=23277#c2

When you build an application with clang, against glibc, disable _FORTIFY_SOURCE.

Comment 4 Fedora End Of Life 2015-11-04 10:01:28 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Fedora End Of Life 2015-12-02 08:25:11 UTC
Fedora 21 changed to end-of-life (EOL) status on 2015-12-01. Fedora 21 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.