diff options
author | Martin Liska <mliska@suse.cz> | 2018-02-20 11:04:13 +0100 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2018-02-20 10:04:13 +0000 |
commit | 5bbccd92506c4d260eca29d12fa30c75aaaee65b (patch) | |
tree | e8b704768df9cda9cb173b4b741372e31194f039 /gcc/opts.c | |
parent | 0b2513e292a70d715affbe4a9b5af6672fcf99b3 (diff) | |
download | gcc-5bbccd92506c4d260eca29d12fa30c75aaaee65b.zip gcc-5bbccd92506c4d260eca29d12fa30c75aaaee65b.tar.gz gcc-5bbccd92506c4d260eca29d12fa30c75aaaee65b.tar.bz2 |
Add limit for maximal alignment options (PR c/84310).
2018-02-20 Martin Liska <mliska@suse.cz>
PR c/84310
PR target/79747
* final.c (shorten_branches): Build align_tab array with one
more element.
* opts.c (finish_options): Add alignment option limit check.
(MAX_CODE_ALIGN): Likewise.
(MAX_CODE_ALIGN_VALUE): Likewise.
* doc/invoke.texi: Document maximum allowed option value for
all -falign-* options.
2018-02-20 Martin Liska <mliska@suse.cz>
PR c/84310
PR target/79747
* gcc.target/i386/pr84310.c: New test.
* gcc.target/i386/pr84310-2.c: Likewise.
From-SVN: r257842
Diffstat (limited to 'gcc/opts.c')
-rw-r--r-- | gcc/opts.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -1039,6 +1039,26 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set, if ((opts->x_flag_sanitize & SANITIZE_KERNEL_ADDRESS) && opts->x_flag_tm) sorry ("transactional memory is not supported with " "%<-fsanitize=kernel-address%>"); + + /* Comes from final.c -- no real reason to change it. */ +#define MAX_CODE_ALIGN 16 +#define MAX_CODE_ALIGN_VALUE (1 << MAX_CODE_ALIGN) + + if (opts->x_align_loops > MAX_CODE_ALIGN_VALUE) + error_at (loc, "-falign-loops=%d is not between 0 and %d", + opts->x_align_loops, MAX_CODE_ALIGN_VALUE); + + if (opts->x_align_jumps > MAX_CODE_ALIGN_VALUE) + error_at (loc, "-falign-jumps=%d is not between 0 and %d", + opts->x_align_jumps, MAX_CODE_ALIGN_VALUE); + + if (opts->x_align_functions > MAX_CODE_ALIGN_VALUE) + error_at (loc, "-falign-functions=%d is not between 0 and %d", + opts->x_align_functions, MAX_CODE_ALIGN_VALUE); + + if (opts->x_align_labels > MAX_CODE_ALIGN_VALUE) + error_at (loc, "-falign-labels=%d is not between 0 and %d", + opts->x_align_labels, MAX_CODE_ALIGN_VALUE); } #define LEFT_COLUMN 27 |