summaryrefslogtreecommitdiff
path: root/gcc/fortran/options.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/options.c')
-rw-r--r--gcc/fortran/options.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index 3e20f8e45d4..3742addb6b1 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -242,6 +242,10 @@ gfc_post_options (const char **pfilename)
if (flag_whole_program)
gfc_option.flag_whole_file = 1;
+ /* Enable whole-file mode if LTO is in effect. */
+ if (flag_lto || flag_whopr)
+ gfc_option.flag_whole_file = 1;
+
/* -fbounds-check is equivalent to -fcheck=bounds */
if (flag_bounds_check)
gfc_option.rtcheck |= GFC_RTCHECK_BOUNDS;