[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 1/3] livepach: Add .livepatch.hooks functions and test-case
>>> On 10.08.16 at 11:46, <JBeulich@xxxxxxxx> wrote: > Odd. I've tried this simple example: > > typedef int fn_t(void); > > struct s { > unsigned n; > fn_t**fn; > fn_t*const*fnc; > const fn_t**cfn; > }; > > int test1(const struct s*ps) { > unsigned i; > int rc = 0; > > for(i = 0; !rc && i < ps->n; ++i) > rc = ps->fn[i](); > > return rc; > } > > int test2(const struct s*ps) { > unsigned i; > int rc = 0; > > for(i = 0; !rc && i < ps->n; ++i) > rc = ps->fnc[i](); > > return rc; > } > > int test3(const struct s*ps) { > unsigned i; > int rc = 0; > > for(i = 0; !rc && i < ps->n; ++i) > rc = ps->cfn[i](); > > return rc; > } > > test1() and test2() get compiled identically. test3(), using the field > with the misplaced const, oddly enough gets compiled slightly > differently (and without a warning despite one would seem > warranted), yet the call doesn't get omitted. If, however, I change > the return type of fn_t to void, the function body of test3() ends > up empty, which is a compiler bug afaict, but which also suggests > that you've tried the variant with the misplaced const. FTR: This is not a compiler bug, as specifically named undefined in the C spec. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |