Flexible I/O Tester development
 help / color / mirror / Atom feed
* FreeBSD build broken following _Static_assert commit
@ 2015-06-29 22:34 Bruce Cran
  2015-06-30  2:48 ` Jens Axboe
  0 siblings, 1 reply; 6+ messages in thread
From: Bruce Cran @ 2015-06-29 22:34 UTC (permalink / raw)
  To: fio@vger.kernel.org

On FreeBSD 10.1 with clang 3.4.1, a standard "gmake" build now fails with:

libfio.c:309:21: error: static_assert expression is not an integral 
constant expression
         compiletime_assert((offsetof(struct thread_stat, 
percentile_list) % 8) == 0, "stat percentile_list");
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./compiler/compiler.h:39:59: note: expanded from macro 'compiletime_assert'
#define compiletime_assert(condition, msg) _Static_assert(condition, msg)
                                                           ^
libfio.c:309:22: note: cast that performs the conversions of a 
reinterpret_cast is not allowed in a constant expression
         compiletime_assert((offsetof(struct thread_stat, 
percentile_list) % 8) == 0, "stat percentile_list");
                             ^
./flist.h:10:33: note: expanded from macro 'offsetof'
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
                                 ^
./compiler/compiler.h:39:59: note: expanded from macro 'compiletime_assert'
#define compiletime_assert(condition, msg) _Static_assert(condition, msg)
                                                           ^
libfio.c:310:21: error: static_assert expression is not an integral 
constant expression
         compiletime_assert((offsetof(struct thread_stat, 
total_run_time) % 8) == 0, "total_run_time");
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./compiler/compiler.h:39:59: note: expanded from macro 'compiletime_assert'
#define compiletime_assert(condition, msg) _Static_assert(condition, msg)
                                                           ^
libfio.c:310:22: note: cast that performs the conversions of a 
reinterpret_cast is not allowed in a constant expression
         compiletime_assert((offsetof(struct thread_stat, 
total_run_time) % 8) == 0, "total_run_time");
                             ^
./flist.h:10:33: note: expanded from macro 'offsetof'
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
                                 ^
./compiler/compiler.h:39:59: note: expanded from macro 'compiletime_assert'
#define compiletime_assert(condition, msg) _Static_assert(condition, msg)
                                                           ^
libfio.c:311:21: error: static_assert expression is not an integral 
constant expression
         compiletime_assert((offsetof(struct thread_stat, 
total_err_count) % 8) == 0, "total_err_count");
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./compiler/compiler.h:39:59: note: expanded from macro 'compiletime_assert'
#define compiletime_assert(condition, msg) _Static_assert(condition, msg)
                                                           ^
libfio.c:311:22: note: cast that performs the conversions of a 
reinterpret_cast is not allowed in a constant expression
         compiletime_assert((offsetof(struct thread_stat, 
total_err_count) % 8) == 0, "total_err_count");
                             ^
./flist.h:10:33: note: expanded from macro 'offsetof'
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
                                 ^
./compiler/compiler.h:39:59: note: expanded from macro 'compiletime_assert'
#define compiletime_assert(condition, msg) _Static_assert(condition, msg)
                                                           ^
libfio.c:312:21: error: static_assert expression is not an integral 
constant expression
         compiletime_assert((offsetof(struct thread_stat, 
latency_percentile) % 8) == 0, "stat latency_percentile");
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./compiler/compiler.h:39:59: note: expanded from macro 'compiletime_assert'
#define compiletime_assert(condition, msg) _Static_assert(condition, msg)
                                                           ^
libfio.c:312:22: note: cast that performs the conversions of a 
reinterpret_cast is not allowed in a constant expression
         compiletime_assert((offsetof(struct thread_stat, 
latency_percentile) % 8) == 0, "stat latency_percentile");
                             ^
./flist.h:10:33: note: expanded from macro 'offsetof'
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
                                 ^
./compiler/compiler.h:39:59: note: expanded from macro 'compiletime_assert'
#define compiletime_assert(condition, msg) _Static_assert(condition, msg)
                                                           ^
libfio.c:313:21: error: static_assert expression is not an integral 
constant expression
         compiletime_assert((offsetof(struct thread_options_pack, 
zipf_theta) % 8) == 0, "zipf_theta");
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./compiler/compiler.h:39:59: note: expanded from macro 'compiletime_assert'
#define compiletime_assert(condition, msg) _Static_assert(condition, msg)
                                                           ^
libfio.c:313:22: note: cast that performs the conversions of a 
reinterpret_cast is not allowed in a constant expression
         compiletime_assert((offsetof(struct thread_options_pack, 
zipf_theta) % 8) == 0, "zipf_theta");
                             ^
./flist.h:10:33: note: expanded from macro 'offsetof'
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
                                 ^
./compiler/compiler.h:39:59: note: expanded from macro 'compiletime_assert'
#define compiletime_assert(condition, msg) _Static_assert(condition, msg)
                                                           ^
libfio.c:314:21: error: static_assert expression is not an integral 
constant expression
         compiletime_assert((offsetof(struct thread_options_pack, 
pareto_h) % 8) == 0, "pareto_h");
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./compiler/compiler.h:39:59: note: expanded from macro 'compiletime_assert'
#define compiletime_assert(condition, msg) _Static_assert(condition, msg)
                                                           ^
libfio.c:314:22: note: cast that performs the conversions of a 
reinterpret_cast is not allowed in a constant expression
         compiletime_assert((offsetof(struct thread_options_pack, 
pareto_h) % 8) == 0, "pareto_h");
                             ^
./flist.h:10:33: note: expanded from macro 'offsetof'
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
                                 ^
./compiler/compiler.h:39:59: note: expanded from macro 'compiletime_assert'
#define compiletime_assert(condition, msg) _Static_assert(condition, msg)
                                                           ^
libfio.c:315:21: error: static_assert expression is not an integral 
constant expression
         compiletime_assert((offsetof(struct thread_options_pack, 
percentile_list) % 8) == 0, "percentile_list");
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./compiler/compiler.h:39:59: note: expanded from macro 'compiletime_assert'
#define compiletime_assert(condition, msg) _Static_assert(condition, msg)
                                                           ^
libfio.c:315:22: note: cast that performs the conversions of a 
reinterpret_cast is not allowed in a constant expression
         compiletime_assert((offsetof(struct thread_options_pack, 
percentile_list) % 8) == 0, "percentile_list");
                             ^
./flist.h:10:33: note: expanded from macro 'offsetof'
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
                                 ^
./compiler/compiler.h:39:59: note: expanded from macro 'compiletime_assert'
#define compiletime_assert(condition, msg) _Static_assert(condition, msg)
                                                           ^
libfio.c:316:21: error: static_assert expression is not an integral 
constant expression
         compiletime_assert((offsetof(struct thread_options_pack, 
latency_percentile) % 8) == 0, "latency_percentile");
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./compiler/compiler.h:39:59: note: expanded from macro 'compiletime_assert'
#define compiletime_assert(condition, msg) _Static_assert(condition, msg)
                                                           ^
libfio.c:316:22: note: cast that performs the conversions of a 
reinterpret_cast is not allowed in a constant expression
         compiletime_assert((offsetof(struct thread_options_pack, 
latency_percentile) % 8) == 0, "latency_percentile");
                             ^
./flist.h:10:33: note: expanded from macro 'offsetof'
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
                                 ^
./compiler/compiler.h:39:59: note: expanded from macro 'compiletime_assert'
#define compiletime_assert(condition, msg) _Static_assert(condition, msg)
                                                           ^
8 errors generated.

-- 
Bruce

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: FreeBSD build broken following _Static_assert commit
  2015-06-29 22:34 FreeBSD build broken following _Static_assert commit Bruce Cran
@ 2015-06-30  2:48 ` Jens Axboe
  2015-06-30  3:41   ` Bruce Cran
  0 siblings, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2015-06-30  2:48 UTC (permalink / raw)
  To: Bruce Cran, fio@vger.kernel.org

On 06/29/2015 04:34 PM, Bruce Cran wrote:
> On FreeBSD 10.1 with clang 3.4.1, a standard "gmake" build now fails with:
>
> libfio.c:309:21: error: static_assert expression is not an integral
> constant expression
>          compiletime_assert((offsetof(struct thread_stat,
> percentile_list) % 8) == 0, "stat percentile_list");

Thanks for reporting this, Bruce. No idea why clang complains about 
that, it's definitely a constant expression. Anyway, committed this:

http://git.kernel.dk/cgit/fio/commit/?id=94815a5c8366a9290167e8539f29994c2d43d15c

which adds this sort of check to the configure _Static_assert() check.

-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: FreeBSD build broken following _Static_assert commit
  2015-06-30  2:48 ` Jens Axboe
@ 2015-06-30  3:41   ` Bruce Cran
  2015-06-30  3:46     ` Jens Axboe
  0 siblings, 1 reply; 6+ messages in thread
From: Bruce Cran @ 2015-06-30  3:41 UTC (permalink / raw)
  To: Jens Axboe, fio@vger.kernel.org

On 6/29/2015 8:48 PM, Jens Axboe wrote:
> Thanks for reporting this, Bruce. No idea why clang complains about 
> that, it's definitely a constant expression. Anyway, committed this:
>
> http://git.kernel.dk/cgit/fio/commit/?id=94815a5c8366a9290167e8539f29994c2d43d15c 
>
>
> which adds this sort of check to the configure _Static_assert() check. 

It seems the relevant text is:

note: cast that performs the conversions of a reinterpret_cast is not 
allowed in a constant expression

Is there something about our use of offsetof that means we can't depend 
on the version from <stddef.h>?

-- 
Bruce



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: FreeBSD build broken following _Static_assert commit
  2015-06-30  3:41   ` Bruce Cran
@ 2015-06-30  3:46     ` Jens Axboe
  2015-06-30 13:22       ` Bruce Cran
  0 siblings, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2015-06-30  3:46 UTC (permalink / raw)
  To: Bruce Cran, fio@vger.kernel.org

On 06/29/2015 09:41 PM, Bruce Cran wrote:
> On 6/29/2015 8:48 PM, Jens Axboe wrote:
>> Thanks for reporting this, Bruce. No idea why clang complains about
>> that, it's definitely a constant expression. Anyway, committed this:
>>
>> http://git.kernel.dk/cgit/fio/commit/?id=94815a5c8366a9290167e8539f29994c2d43d15c
>>
>>
>> which adds this sort of check to the configure _Static_assert() check.
>
> It seems the relevant text is:
>
> note: cast that performs the conversions of a reinterpret_cast is not
> allowed in a constant expression

But it's bogus, it's nothing but static pointer math.

> Is there something about our use of offsetof that means we can't depend
> on the version from <stddef.h>?

No other reason than having a generic solution is superior to depending 
on whatever might be supplied with the given system.

-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: FreeBSD build broken following _Static_assert commit
  2015-06-30  3:46     ` Jens Axboe
@ 2015-06-30 13:22       ` Bruce Cran
  2015-06-30 13:51         ` Jens Axboe
  0 siblings, 1 reply; 6+ messages in thread
From: Bruce Cran @ 2015-06-30 13:22 UTC (permalink / raw)
  To: Jens Axboe, fio@vger.kernel.org

On 6/29/2015 9:46 PM, Jens Axboe wrote:
> But it's bogus, it's nothing but static pointer math.

Apparently it's a known bug: https://llvm.org/bugs/show_bug.cgi?id=17410 .
It looks like on FreeBSD there's no __compiler_offsetof (which on Linux 
ends up being defined as __builtin_offsetof) but clang _does_ provide 
__builtin_offsetof.

-- 
Bruce


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: FreeBSD build broken following _Static_assert commit
  2015-06-30 13:22       ` Bruce Cran
@ 2015-06-30 13:51         ` Jens Axboe
  0 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2015-06-30 13:51 UTC (permalink / raw)
  To: Bruce Cran, fio@vger.kernel.org

On 06/30/2015 07:22 AM, Bruce Cran wrote:
> On 6/29/2015 9:46 PM, Jens Axboe wrote:
>> But it's bogus, it's nothing but static pointer math.
>
> Apparently it's a known bug: https://llvm.org/bugs/show_bug.cgi?id=17410 .
> It looks like on FreeBSD there's no __compiler_offsetof (which on Linux
> ends up being defined as __builtin_offsetof) but clang _does_ provide
> __builtin_offsetof.

I used clang 3.6.0 to reproduce it, so apparently still not fixed. If 
you want to do a cleanup around what I committed, feel free, but as far 
as I'm concerned, it's resolved.

-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-06-30 13:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-29 22:34 FreeBSD build broken following _Static_assert commit Bruce Cran
2015-06-30  2:48 ` Jens Axboe
2015-06-30  3:41   ` Bruce Cran
2015-06-30  3:46     ` Jens Axboe
2015-06-30 13:22       ` Bruce Cran
2015-06-30 13:51         ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox