@@ -243,7 +243,7 @@ virt_loc_aware_diagnostic_finalizer (dia
}
/* Default tree printer. Handles declarations only. */
-static bool
+bool
default_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
int precision, bool wide, bool set_locus, bool hash)
{
@@ -54,4 +54,7 @@ void virt_loc_aware_diagnostic_finalizer
diagnostic_info *);
void tree_diagnostics_defaults (diagnostic_context *context);
+bool default_tree_printer (pretty_printer *, text_info *, const char *,
+ int, bool, bool, bool);
+
#endif /* ! GCC_TREE_DIAGNOSTIC_H */
@@ -916,10 +916,8 @@ gfc_notify_std (int std, const char *gms
%L Takes locus argument
*/
static bool
-gfc_format_decoder (pretty_printer *pp,
- text_info *text, const char *spec,
- int precision ATTRIBUTE_UNUSED, bool wide ATTRIBUTE_UNUSED,
- bool plus ATTRIBUTE_UNUSED, bool hash ATTRIBUTE_UNUSED)
+gfc_format_decoder (pretty_printer *pp, text_info *text, const char *spec,
+ int precision, bool wide, bool set_locus, bool hash)
{
switch (*spec)
{
@@ -946,7 +944,11 @@ gfc_format_decoder (pretty_printer *pp,
return true;
}
default:
- return false;
+ /* Fall through info the middle-end decoder, as e.g. stor-layout.c
+ etc. diagnostics can use the FE printer while the FE is still
+ active. */
+ return default_tree_printer (pp, text, spec, precision, wide,
+ set_locus, hash);
}
}
@@ -32,6 +32,7 @@ along with GCC; see the file COPYING3.
#include "trans-array.h"
#include "trans-types.h"
#include "trans-const.h"
+#include "options.h"
/* Members of the ioparm structure. */
@@ -219,7 +220,12 @@ gfc_build_st_parameter (enum ioparam_typ
gcc_unreachable ();
}
+ /* -Wpadded warnings on these artificially created structures are not
+ helpful; suppress them. */
+ int save_warn_padded = warn_padded;
+ warn_padded = 0;
gfc_finish_type (t);
+ warn_padded = save_warn_padded;
st_parameter[ptype].type = t;
}
@@ -0,0 +1,17 @@
+! PR fortran/79886
+! { dg-do compile }
+! { dg-options "-Wpadded" }
+
+subroutine pr79886
+ type :: foo
+ integer (kind=1) :: a
+ integer (kind=8) :: b ! { dg-warning "padding struct to align" }
+ integer (kind=1) :: c
+ integer (kind=8) :: d ! { dg-warning "padding struct to align" }
+ end type
+ type (foo) :: f
+ f%a = 1
+ f%b = 2
+ f%c = 3
+ f%d = 4
+end subroutine