LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 19723 - Second stage bootstrap failure after r207606
Summary: Second stage bootstrap failure after r207606
Status: RESOLVED FIXED
Alias: None
Product: libc++
Classification: Unclassified
Component: All Bugs (show other bugs)
Version: unspecified
Hardware: PC Linux
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-12 06:02 PDT by İsmail Dönmez
Modified: 2014-05-15 20:47 PDT (History)
5 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description İsmail Dönmez 2014-05-12 06:02:30 PDT
r207606 has broken stage2 bootstrap on openSUSE 13.1 i586/x86-64 with libcxx/libcxxabi enabled:

[  723s] FAILED: /home/abuild/rpmbuild/BUILD/llvm/stage1/bin/clang++   -DLLVMSupport_EXPORTS -DNDEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -stdlib=libc++ -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -fcolor-diagnostics -ffunction-sections -fdata-sections -O2 -g -DNDEBUG -fPIC -Ilib/Support -I../lib/Support -Iinclude -I../include    -fno-exceptions -MMD -MT lib/Support/CMakeFiles/LLVMSupport.dir/Allocator.cpp.o -MF lib/Support/CMakeFiles/LLVMSupport.dir/Allocator.cpp.o.d -o lib/Support/CMakeFiles/LLVMSupport.dir/Allocator.cpp.o -c ../lib/Support/Allocator.cpp
[  723s] In file included from ../lib/Support/Allocator.cpp:14:
[  723s] ../include/llvm/Support/Allocator.h:421:65: error: 'S' does not refer to a value
[  723s]       Size, std::min((size_t)llvm::NextPowerOf2(Size), offsetof(S, x)));
[  723s]                                                                 ^
[  723s] ../include/llvm/Support/Allocator.h:411:10: note: declared here
[  723s]   struct S {
[  723s]          ^
[  723s] 1 error generated.

The difference between non-working and working preprocessed file is:

@@ -36617,7 +36628,7 @@
     } x;
   };
   return Allocator.Allocate(
-      Size, std::min((size_t)llvm::NextPowerOf2(Size), offsetof(S, x)));
+      Size, std::min((size_t)llvm::NextPowerOf2(Size), __builtin_offsetof(S, x)));
 }

Reverting r207606 fixes the problem.
Comment 1 Nico Weber 2014-05-12 12:41:03 PDT
libc++'s cstddef says:

#ifdef __GLIBC__
#define __need_NULL
#define __need_ptrdiff_t
#define __need_size_t
#endif  // __GLIBC__

#include <stddef.h>


r207606 changed the __need_foo macros to behave like they do with gcc: If they are set, _only_ the __need_foo stuff gets defined.


These lines were added with the cryptic comment "for ubuntu" -- I think they're just wrong, after r207606. Can you check if this patch fixes things for you?

 thakis$ svn diff
Index: include/cstddef
===================================================================
--- include/cstddef	(revision 195228)
+++ include/cstddef	(working copy)
@@ -36,11 +36,6 @@
 #include <__config>
 
 #ifdef __GLIBC__
-#define __need_NULL
-#define __need_ptrdiff_t
-#define __need_size_t
-#endif  // __GLIBC__
-
 #include <stddef.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Comment 2 Nico Weber 2014-05-12 12:41:29 PDT
Sorry, this patch:

thakis$ svn diff include/cstddef 
Index: include/cstddef
===================================================================
--- include/cstddef	(revision 195228)
+++ include/cstddef	(working copy)
@@ -35,12 +35,6 @@
 
 #include <__config>
 
-#ifdef __GLIBC__
-#define __need_NULL
-#define __need_ptrdiff_t
-#define __need_size_t
-#endif  // __GLIBC__
-
 #include <stddef.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Comment 3 İsmail Dönmez 2014-05-13 03:07:55 PDT
(In reply to comment #2)
> Sorry, this patch:
> 
> thakis$ svn diff include/cstddef 
> Index: include/cstddef
> ===================================================================
> --- include/cstddef	(revision 195228)
> +++ include/cstddef	(working copy)
> @@ -35,12 +35,6 @@
>  
>  #include <__config>
>  
> -#ifdef __GLIBC__
> -#define __need_NULL
> -#define __need_ptrdiff_t
> -#define __need_size_t
> -#endif  // __GLIBC__
> -
>  #include <stddef.h>
>  
>  #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)

This fixes the problem, thanks!
Comment 4 Nico Weber 2014-05-13 04:54:00 PDT
Thanks for testing! I sent that patch out for review here: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140512/105387.html
Comment 5 Nico Weber 2014-05-15 20:47:10 PDT
r208942