http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46638
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-11-24 08:41:15 UTC --- More details: The run-time folding works; the issue is the compile time. The call to gfc_target_encode_expr (source, buffer, buffer_size); looks OK (buffer size = 16, source is the string.) Up to gfc_encode_character is seems to be OK. I think something goes wrong in gfc_target_interpret_expr possibly in gfc_interpret_derived. The dump looks as follows: struct cpuid_type cpuid_type.0; cpuid_type.0.eax = 10; cpuid_type.0.ebx = 10; cpuid_type.0.edx = 10; cpuid_type.0.ecx = 10; result = cpuid_type.0; The problem seems to be that ptr = TREE_INT_CST_LOW (DECL_FIELD_OFFSET (cmp->backend_decl)); return "0" for all components: (gdb) p debug_tree(result->ts.u.derived->components->backend_decl->field_decl->offset) <integer_cst 0x2aaaaab35410 type <integer_type 0x2aaaaab45000> constant 0> $18 = void (gdb) p debug_tree(result->ts.u.derived->components->next->backend_decl->field_decl->offset) <integer_cst 0x2aaaaab35410 type <integer_type 0x2aaaaab45000> constant 0> $19 = void