Re: master doesn't compile on xlc 21.01 anymore (old AIX compiler) (was: [PATCH v7 14/16] reftable: make reftable_record a tagged union)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 19.02.22 um 13:54 schrieb Ævar Arnfjörð Bjarmason:
>
> On Mon, Jan 24 2022, Ævar Arnfjörð Bjarmason wrote:
>
>> On Mon, Jan 24 2022, Han-Wen Nienhuys wrote:
>>
>>> On Mon, Jan 24, 2022 at 8:44 PM Ævar Arnfjörð Bjarmason
>>> <avarab@xxxxxxxxx> wrote:
>>>
>>>> I didn't test the v6 on xlc on AIX 7.1, but found that it refuses to
>>>> compile this code (but the one on AIX 7.2 is OK with it):
>>>>
>>>>     "reftable/generic.c", line 135.26: 1506-196 (S) Initialization between types "char*" and "struct reftable_ref_record" is not allowed.
>>>>     "reftable/generic.c", line 147.26: 1506-196 (S) Initialization between types "char*" and "struct reftable_log_record" is not allowed.
>>>>     "reftable/writer.c", line 261.26: 1506-196 (S) Initialization between types "char*" and "struct reftable_ref_record" is not allowed.
>>>>     "reftable/writer.c", line 312.26: 1506-196 (S) Initialization between types "char*" and "struct reftable_log_record" is not allowed.
>>>>     "reftable/writer.c", line 406.45: 1506-196 (S) Initialization between types "unsigned long long" and "struct reftable_index_record" is not allowed.
>>>>
>>>
>>>> I.e. you're dereferencing a struct type here to get at its first member,
>>>
>>> No, that's not what I'm doing.
>>>
>>>>> +   struct reftable_record rec = {
>>>>> +             .type = BLOCK_TYPE_REF,
>>>>> +             .u.ref = *ref,
>>>>> +     };
>>>
>>> reftable_record is tagged union, and u.ref is a reftable_ref_record. I
>>> intend to shallow-copying the parameter (a reftable_record called
>>> 'ref') into 'rec.u.ref' , precisely as it is written.
>>>
>>> Does this patch pass the unittests?
>>
>> No, sorry about that. It fails. I didn't have time to run them earlier
>> (and it takes a while on that platform).
>>
>> I don't know how to work around it then...
>
> Just a reminder that now with this landed on master we've hard broken
> compilation on that version of xlc:
>
>     avar@gcc111:[/home/avar]xlc -qversion
>     IBM XL C/C++ for AIX, V12.1 (5765-J02, 5725-C72)
>     Version: 12.01.0000.0000
>
> The error is:
>
>     "reftable/generic.c", line 133.26: 1506-196 (S) Initialization between types "char*" and "struct reftable_ref_record" is not allowed.
>     "reftable/generic.c", line 145.26: 1506-196 (S) Initialization between types "char*" and "struct reftable_log_record" is not allowed.
>
> Is there really no workaround we can think of for this?

The code is hard to read for me in general due to its many types and
function dispatch tables, but this compiler seems to have an even harder
time.  Where does it even get that char pointer type from?

Can it compile this?

	struct reftable_record rec = {
		.type = BLOCK_TYPE_REF,
		.u = {
			.ref = *ref
		},
	};

If it can't, what about this?

	struct reftable_record rec = {
		.type = BLOCK_TYPE_REF,
	};
	rec.u.ref = *ref;

René




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux