[jdk8u-dev] RFR: 8329826: GCC 12 reports some compiler error when building jdk8
Simon Tooke
stooke at openjdk.org
Tue May 7 16:59:59 UTC 2024
On Tue, 16 Apr 2024 14:34:49 GMT, mirabilos <duke at openjdk.org> wrote:
>> Env:
>> ldd (GNU libc) 2.38
>> gcc (GCC) 12.3.1
>>
>> Test the PR patch;
>> Build release/fastdebug/slowdebug version pass
>>
>> Reported issue : https://bugs.openjdk.org/browse/JDK-8329826
>
> hotspot/src/share/vm/opto/type.cpp line 2560:
>
>> 2558: ciInstanceKlass* k = o->as_instance()->java_lang_Class_klass()->as_instance_klass();
>> 2559: field = k->get_field_by_offset(_offset, true);
>> 2560: }
>
> This is useless papering over, not a fix, and not even good because it makes the code less legible at no gain.
>
> Better to convert the two `assert`s to actual checks which abort the control flow of the function if triggered.
(disclaimer: I am not a reviewer)
This proposed change doesn't really handle the case where o == NULL, although it makes the compiler happy. I propose something like:
assert(o != NULL, "must be constant");
if (o != NULL) {
ciInstanceKlass* k = o->as_instance()->java_lang_Class_klass()->as_instance_klass();
ciField* field = k->get_field_by_offset(_offset, true);
assert(field != NULL, "missing field");
BasicType basic_elem_type = field->layout_type();
_is_ptr_to_narrowoop = UseCompressedOops && (basic_elem_type == T_OBJECT ||
basic_elem_type == T_ARRAY);
} else {
_is_ptr_to_narrowoop = (?? I am not familiar enough with this code to put a suggestion here)
}
-------------
PR Review Comment: https://git.openjdk.org/jdk8u-dev/pull/479#discussion_r1592801721
More information about the jdk8u-dev
mailing list