https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119241

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
I see odd code like

          // For some reason, using FLOAT128 in the build_pointer_type causes
          // a SEGFAULT.  So, we'll use other types with equivalent sizes. I
          // am speculating that the use of floating-point types causes the -O0
          // compilation to move things using the mmx registers.  So, I am
using
          // intxx types in the hope that they are simpler.
          case 4:
            {
            // The following generated code is the exact equivalent
            // of the C code:
            //   *(float *)dest = (float)data.value
            _Float32 src = (_Float32)sourceref.field->data.value;
            tree tsrc    = build_string_literal(sizeof(src), (char *)&src);
            gg_assign(gg_indirect(gg_cast(build_pointer_type(INT), tdest)),
                      gg_indirect(gg_cast(build_pointer_type(INT), tsrc )));
            break;

that most definitely is weird because it uses the host representation and
endianess.  The comment writes float data while the code generates
integer type accesses.

I have a partial patch that replaces sourceref.field->data.value with a
tree which then enables simpler

          case 4:
            {
            // The following generated code is the exact equivalent
            // of the C code:
            //   *(float *)dest = (float)data.value
            gg_assign(gg_indirect(gg_cast(build_pointer_type(FLOAT), tdest)),
                      fold_convert (FLOAT, sourceref.field->data.value));
            break;

Reply via email to