https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90045
--- Comment #9 from Martin Liška <marxin at gcc dot gnu.org> --- (In reply to rguent...@suse.de from comment #7) > On Thu, 18 Apr 2019, marxin at gcc dot gnu.org wrote: > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90045 > > > > Martin Liška <marxin at gcc dot gnu.org> changed: > > > > What |Removed |Added > > ---------------------------------------------------------------------------- > > See Also| |https://sourceware.org/bugz > > | |illa/show_bug.cgi?id=24464 > > > > --- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> --- > > I created a binutils bug: > > https://sourceware.org/bugzilla/show_bug.cgi?id=24464 > > But compiler behavior changed from GCC 8 -> 9 with your changes. > I do not think that the .balign is desired (I guess the backend > doesn't properly take that into account when choosing jump form). Yes, the change was not 1:1, there are some differences. > > Do you understand why your changes caused this change in behavior? Yes, first before my first commit r262374, rx was the only target that defined: gcc/config/rx/rx.c:#define TARGET_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP rx_max_skip_for_label However in final.c: 944 if (rtx_code_label *label = dyn_cast <rtx_code_label *> (insn)) 945 { 946 /* Merge in alignments computed by compute_alignments. */ 947 log = LABEL_TO_ALIGNMENT (label); 948 if (max_log < log) 949 { 950 max_log = log; 951 max_skip = LABEL_TO_MAX_SKIP (label); 952 } 953 954 rtx_jump_table_data *table = jump_table_for_label (label); 955 if (!table) 956 { 957 log = LABEL_ALIGN (label); 958 if (max_log < log) 959 { 960 max_log = log; 961 max_skip = targetm.asm_out.label_align_max_skip (label); 962 } 963 } 964 /* ADDR_VECs only take room if read-only data goes into the text 965 section. */ 966 if ((JUMP_TABLES_IN_TEXT_SECTION 967 || readonly_data_section == text_section) 968 && table) 969 { 970 log = ADDR_VEC_ALIGN (table); 971 if (max_log < log) 972 { 973 max_log = log; 974 max_skip = targetm.asm_out.label_align_max_skip (label); 975 } 976 } 977 LABEL_TO_ALIGNMENT (label) = max_log; 978 LABEL_TO_MAX_SKIP (label) = max_skip; 979 max_log = 0; 980 max_skip = 0; 981 } 982 else if (BARRIER_P (insn)) 983 { 984 rtx_insn *label; 985 986 for (label = insn; label && ! INSN_P (label); 987 label = NEXT_INSN (label)) 988 if (LABEL_P (label)) 989 { 990 log = LABEL_ALIGN_AFTER_BARRIER (insn); 991 if (max_log < log) 992 { 993 max_log = log; 994 max_skip = targetm.asm_out.label_align_after_barrier_max_skip (label); 995 } 996 break; 997 } 998 } The call at 994 didn't call rx_max_skip_for_label (which would return 1), but default_label_align_after_barrier_max_skip was called and returned 0. So max_skip is 0. Then at 948 we don't adjust max_skip as max_log == log. So that we end up with max_log == 3 and max_skip == 0 and so that no .balign is used. For current trunk, TARGET_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP is gone and the code looks as follows: 878 if (rtx_code_label *label = dyn_cast <rtx_code_label *> (insn)) 879 { 880 /* Merge in alignments computed by compute_alignments. */ 881 align_flags alignment = LABEL_TO_ALIGNMENT (label); 882 max_alignment = align_flags::max (max_alignment, alignment); 883 884 rtx_jump_table_data *table = jump_table_for_label (label); 885 if (!table) 886 { 887 align_flags alignment = LABEL_ALIGN (label); 888 max_alignment = align_flags::max (max_alignment, alignment); 889 } 890 /* ADDR_VECs only take room if read-only data goes into the text 891 section. */ 892 if ((JUMP_TABLES_IN_TEXT_SECTION 893 || readonly_data_section == text_section) 894 && table) 895 { 896 align_flags alignment = align_flags (ADDR_VEC_ALIGN (table)); 897 max_alignment = align_flags::max (max_alignment, alignment); 898 } 899 LABEL_TO_ALIGNMENT (label) = max_alignment; 900 max_alignment = align_flags (); 901 } 902 else if (BARRIER_P (insn)) 903 { 904 rtx_insn *label; 905 906 for (label = insn; label && ! INSN_P (label); 907 label = NEXT_INSN (label)) 908 if (LABEL_P (label)) 909 { 910 align_flags alignment 911 = align_flags (LABEL_ALIGN_AFTER_BARRIER (insn)); 912 max_alignment = align_flags::max (max_alignment, alignment); 913 break; 914 } 915 } Where at 912 we have (log=3, maxskip=1), and then we merge it at 882 with (log=3, maxskip=7) and we end up with (3,7). Yes, I can confirm that with current trunk we make a bigger alignment. But still, gas should not fail.