Starting from r217383 we ICE: $ gfortran /home/marxin/Programming/gcc/gcc/testsuite/gfortran.fortran-torture/compile/pr26806.f90 -Wpadded f951: Warning: padding struct size to alignment boundary [-Wpadded] f951: Warning: padding struct size to alignment boundary [-Wpadded] ‘ in pp_format, at pretty-print.c:681 0x1478169 pp_format(pretty_printer*, text_info*) ../../gcc/pretty-print.c:681 0x146a9f8 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*) ../../gcc/diagnostic.c:961 0x146ad53 diagnostic_impl ../../gcc/diagnostic.c:1084 0x146b0cc warning(int, char const*, ...) ../../gcc/diagnostic.c:1172 0xc5a315 place_field(record_layout_info_s*, tree_node*) ../../gcc/stor-layout.c:1215 0xc5bafa layout_type(tree_node*) ../../gcc/stor-layout.c:2375 0x7d4a66 gfc_finish_type(tree_node*) ../../gcc/fortran/trans-types.c:2251 0x7acb43 gfc_build_st_parameter ../../gcc/fortran/trans-io.c:222 0x7acb43 gfc_build_io_library_fndecls() ../../gcc/fortran/trans-io.c:318 0x765c17 gfc_build_builtin_function_decls() ../../gcc/fortran/trans-decl.c:3771 0x73b71a gfc_create_decls ../../gcc/fortran/f95-lang.c:189 0x73b71a gfc_be_parse_file ../../gcc/fortran/f95-lang.c:203
This is probably a warning from the middle end with a printf %-code not supported by the Fortran FE's pretty printer. The solution is to either add support for it in the FE or switch to the middle end pp when entering the middle end. There are several bugs like this one. Another solution is to either not call into the middle end at arbitrary points during parsing only during gimplification (not sure if this is the case here) or move the warning to the FE (middle end warnings should be avoided if possible). On 6 Mar 2017 8:04 a.m., "marxin at gcc dot gnu.org" < gcc-bugzilla@gcc.gnu.org> wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79886 > > Bug ID: 79886 > Summary: [5/6/7 Regression] ICE in pp_format, at > pretty-print.c:681 > Product: gcc > Version: 7.0 > Status: UNCONFIRMED > Keywords: ice-on-valid-code > Severity: normal > Priority: P3 > Component: fortran > Assignee: unassigned at gcc dot gnu.org > Reporter: marxin at gcc dot gnu.org > CC: manu at gcc dot gnu.org > Target Milestone: --- > > Starting from r217383 we ICE: > > $ gfortran > /home/marxin/Programming/gcc/gcc/testsuite/gfortran. > fortran-torture/compile/pr26806.f90 > -Wpadded > f951: Warning: padding struct size to alignment boundary [-Wpadded] > f951: Warning: padding struct size to alignment boundary [-Wpadded] > ‘ > in pp_format, at pretty-print.c:681 > 0x1478169 pp_format(pretty_printer*, text_info*) > ../../gcc/pretty-print.c:681 > 0x146a9f8 diagnostic_report_diagnostic(diagnostic_context*, > diagnostic_info*) > ../../gcc/diagnostic.c:961 > 0x146ad53 diagnostic_impl > ../../gcc/diagnostic.c:1084 > 0x146b0cc warning(int, char const*, ...) > ../../gcc/diagnostic.c:1172 > 0xc5a315 place_field(record_layout_info_s*, tree_node*) > ../../gcc/stor-layout.c:1215 > 0xc5bafa layout_type(tree_node*) > ../../gcc/stor-layout.c:2375 > 0x7d4a66 gfc_finish_type(tree_node*) > ../../gcc/fortran/trans-types.c:2251 > 0x7acb43 gfc_build_st_parameter > ../../gcc/fortran/trans-io.c:222 > 0x7acb43 gfc_build_io_library_fndecls() > ../../gcc/fortran/trans-io.c:318 > 0x765c17 gfc_build_builtin_function_decls() > ../../gcc/fortran/trans-decl.c:3771 > 0x73b71a gfc_create_decls > ../../gcc/fortran/f95-lang.c:189 > 0x73b71a gfc_be_parse_file > ../../gcc/fortran/f95-lang.c:203 > > -- > You are receiving this mail because: > You are on the CC list for the bug.
I wouldn't call layout_type a middle-end, rather a helper shared by all FEs. It would be best if the Fortran formatters were limited only to the Fortran specific diagnostic functions (gfc_*) and error/error_at/warning_at etc. just used the standard formatters.
Perhaps Fortran FE formatters can call the standard formatters if an unknown directive is found? I don't know how C/C++ handles this case (does it support this %-directive or does it switch to the standard pretty printer?) but there is no reason to not do the same and share the code if possible.
http://gcc.gnu.org/ml/gcc-patches/2017-03/msg00334.html
The first one seems the right approach. It will also fix a number of similar bugs in one go.The second one seems more fragile and it doesn't help in decoupling ME from FE more than the first.
Author: jakub Date: Thu Mar 16 16:27:08 2017 New Revision: 246203 URL: https://gcc.gnu.org/viewcvs?rev=246203&root=gcc&view=rev Log: PR fortran/79886 * tree-diagnostic.c (default_tree_printer): No longer static. * tree-diagnostic.h (default_tree_printer): New prototype. fortran/ * error.c (gfc_format_decoder): Rename plus argument to set_locus, remove ATTRIBUTE_UNUSED from all arguments, call default_tree_printer if not a Fortran specific spec. * trans-io.c: Include options.h. (gfc_build_st_parameter): Temporarily disable -Wpadded around layout of artificial IO data structures. testsuite/ * gfortran.dg/pr79886.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/pr79886.f90 Modified: trunk/gcc/ChangeLog trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/error.c trunk/gcc/fortran/trans-io.c trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-diagnostic.c trunk/gcc/tree-diagnostic.h
Fixed on the trunk so far.
GCC 5 branch is being closed
Any plans to backport to gcc-6? If not, I think we can close this.
(In reply to Thomas Koenig from comment #9) > Any plans to backport to gcc-6? > > If not, I think we can close this. Doesn't look like. Also, I would suspect that there would be at maximum one final revision of gcc-6 and then it will go out of support? So, if backporting to gcc-6 is the only open issue, and nobody is doing it (which I don't really see much urgency for), I'd close this PR.
So let‘s close this.