diff --git a/gcc41-pr33423.patch b/gcc41-pr33423.patch new file mode 100644 index 0000000..46cfe29 --- /dev/null +++ b/gcc41-pr33423.patch @@ -0,0 +1,61 @@ +2007-09-15 Jakub Jelinek + + PR middle-end/33423 + * builtins.c (expand_builtin_memory_chk): Handle COMPOUND_EXPRs + returned by build_call_expr. + + * gcc.c-torture/compile/20070915-1.c: New test. + +--- gcc/builtins.c.jj 2007-09-14 21:07:41.000000000 +0200 ++++ gcc/builtins.c 2007-09-16 22:31:40.000000000 +0200 +@@ -10383,6 +10383,13 @@ expand_builtin_memory_chk (tree exp, rtx + return 0; + + fn = build_function_call_expr (fn, arglist); ++ STRIP_TYPE_NOPS (fn); ++ while (TREE_CODE (fn) == COMPOUND_EXPR) ++ { ++ expand_expr (TREE_OPERAND (fn, 0), const0_rtx, VOIDmode, ++ EXPAND_NORMAL); ++ fn = TREE_OPERAND (fn, 1); ++ } + if (TREE_CODE (fn) == CALL_EXPR) + CALL_EXPR_TAILCALL (fn) = CALL_EXPR_TAILCALL (exp); + return expand_expr (fn, target, mode, EXPAND_NORMAL); +@@ -10432,6 +10439,13 @@ expand_builtin_memory_chk (tree exp, rtx + if (!fn) + return 0; + fn = build_function_call_expr (fn, arglist); ++ STRIP_TYPE_NOPS (fn); ++ while (TREE_CODE (fn) == COMPOUND_EXPR) ++ { ++ expand_expr (TREE_OPERAND (fn, 0), const0_rtx, VOIDmode, ++ EXPAND_NORMAL); ++ fn = TREE_OPERAND (fn, 1); ++ } + if (TREE_CODE (fn) == CALL_EXPR) + CALL_EXPR_TAILCALL (fn) = CALL_EXPR_TAILCALL (exp); + return expand_expr (fn, target, mode, EXPAND_NORMAL); +--- gcc/testsuite/gcc.c-torture/compile/20070915-1.c.jj 2007-09-16 22:29:37.000000000 +0200 ++++ gcc/testsuite/gcc.c-torture/compile/20070915-1.c 2007-09-16 22:29:37.000000000 +0200 +@@ -0,0 +1,20 @@ ++/* PR middle-end/33423 */ ++ ++static struct ++{ ++ char buf[15]; ++} u2; ++ ++void ++test6 (void) ++{ ++ int len; ++ char *p; ++ ++ for (len = 0; len < 2; len++) ++ { ++ p = __builtin___memset_chk (u2.buf, '\0', len, 15); ++ if (p != u2.buf) ++ return; ++ } ++} diff --git a/gcc41-scanf-fmt-check.patch b/gcc41-scanf-fmt-check.patch new file mode 100644 index 0000000..4143e38 --- /dev/null +++ b/gcc41-scanf-fmt-check.patch @@ -0,0 +1,433 @@ +2007-09-17 Jakub Jelinek + + * c-format.h (format_kind_info): Add alloc_char field. + * c-format.c (scanf_flag_specs): Add 'm'. + (scanf_flag_pairs): Add 'a', 'm' pair. + (scan_char_table): Allow 'm' modifier for c, s, [, C and S. + (format_types_orig): Add alloc_char fields. + (check_format_info_main): Rename aflag to alloc_flag. + Handle fki->alloc_char. modifier after width and before length + modifiers. Move FMT_FLAG_SCANF_A_KLUDGE handling before + length modifiers as well. + * config/sol2-c.c (solaris_format_types): Add alloc_char field. + + * gcc.dg/format/c90-scanf-5.c: New test. + * gcc.dg/format/c99-scanf-4.c: New test. + * gcc.dg/format/ext-7.c: New test. + * gcc.dg/format/ext-8.c: New test. + +--- gcc/c-format.h.jj 2007-02-20 22:39:12.000000000 +0100 ++++ gcc/c-format.h 2007-09-17 22:44:17.000000000 +0200 +@@ -234,6 +234,8 @@ typedef struct + specifiers, but is used to check for bad combinations such as length + modifier with assignment suppression in scanf. */ + int length_code_char; ++ /* Assignment-allocation flag character ('m' in scanf), otherwise 0. */ ++ int alloc_char; + /* Pointer to type of argument expected if '*' is used for a width, + or NULL if '*' not used for widths. */ + tree *width_type; +--- gcc/c-format.c.jj 2007-02-20 22:39:12.000000000 +0100 ++++ gcc/c-format.c 2007-09-17 22:51:08.000000000 +0200 +@@ -423,6 +423,7 @@ static const format_flag_spec scanf_flag + { + { '*', 0, 0, N_("assignment suppression"), N_("the assignment suppression scanf feature"), STD_C89 }, + { 'a', 0, 0, N_("'a' flag"), N_("the 'a' scanf flag"), STD_EXT }, ++ { 'm', 0, 0, N_("'m' flag"), N_("the 'm' scanf flag"), STD_EXT }, + { 'w', 0, 0, N_("field width"), N_("field width in scanf format"), STD_C89 }, + { 'L', 0, 0, N_("length modifier"), N_("length modifier in scanf format"), STD_C89 }, + { '\'', 0, 0, N_("''' flag"), N_("the ''' scanf flag"), STD_EXT }, +@@ -434,6 +435,7 @@ static const format_flag_spec scanf_flag + static const format_flag_pair scanf_flag_pairs[] = + { + { '*', 'L', 0, 0 }, ++ { 'a', 'm', 0, 0 }, + { 0, 0, 0, 0 } + }; + +@@ -648,16 +650,16 @@ static const format_char_info scan_char_ + { "u", 1, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM }, "*w'I", "W", NULL }, + { "oxX", 1, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM }, "*w", "W", NULL }, + { "efgEG", 1, STD_C89, { T89_F, BADLEN, BADLEN, T89_D, BADLEN, T89_LD, BADLEN, BADLEN, BADLEN }, "*w'", "W", NULL }, +- { "c", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*w", "cW", NULL }, +- { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*aw", "cW", NULL }, +- { "[", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*aw", "cW[", NULL }, ++ { "c", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*mw", "cW", NULL }, ++ { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*amw", "cW", NULL }, ++ { "[", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*amw", "cW[", NULL }, + { "p", 2, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*w", "W", NULL }, + { "n", 1, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, BADLEN, T99_SST, T99_PD, T99_IM }, "", "W", NULL }, + /* C99 conversion specifiers. */ + { "FaA", 1, STD_C99, { T99_F, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN }, "*w'", "W", NULL }, + /* X/Open conversion specifiers. */ +- { "C", 1, STD_EXT, { TEX_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*w", "W", NULL }, +- { "S", 1, STD_EXT, { TEX_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*aw", "W", NULL }, ++ { "C", 1, STD_EXT, { TEX_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*mw", "W", NULL }, ++ { "S", 1, STD_EXT, { TEX_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*amw", "W", NULL }, + { NULL, 0, 0, NOLENGTHS, NULL, NULL, NULL } + }; + +@@ -700,59 +702,59 @@ static const format_kind_info format_typ + { "printf", printf_length_specs, print_char_table, " +#0-'I", NULL, + printf_flag_specs, printf_flag_pairs, + FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK, +- 'w', 0, 'p', 0, 'L', ++ 'w', 0, 'p', 0, 'L', 0, + &integer_type_node, &integer_type_node + }, + { "asm_fprintf", asm_fprintf_length_specs, asm_fprintf_char_table, " +#0-", NULL, + asm_fprintf_flag_specs, asm_fprintf_flag_pairs, + FMT_FLAG_ARG_CONVERT|FMT_FLAG_EMPTY_PREC_OK, +- 'w', 0, 'p', 0, 'L', ++ 'w', 0, 'p', 0, 'L', 0, + NULL, NULL + }, + { "gcc_diag", gcc_diag_length_specs, gcc_diag_char_table, "q+", NULL, + gcc_diag_flag_specs, gcc_diag_flag_pairs, + FMT_FLAG_ARG_CONVERT, +- 0, 0, 'p', 0, 'L', ++ 0, 0, 'p', 0, 'L', 0, + NULL, &integer_type_node + }, + { "gcc_tdiag", gcc_tdiag_length_specs, gcc_tdiag_char_table, "q+", NULL, + gcc_tdiag_flag_specs, gcc_tdiag_flag_pairs, + FMT_FLAG_ARG_CONVERT, +- 0, 0, 'p', 0, 'L', ++ 0, 0, 'p', 0, 'L', 0, + NULL, &integer_type_node + }, + { "gcc_cdiag", gcc_cdiag_length_specs, gcc_cdiag_char_table, "q+", NULL, + gcc_cdiag_flag_specs, gcc_cdiag_flag_pairs, + FMT_FLAG_ARG_CONVERT, +- 0, 0, 'p', 0, 'L', ++ 0, 0, 'p', 0, 'L', 0, + NULL, &integer_type_node + }, + { "gcc_cxxdiag", gcc_cxxdiag_length_specs, gcc_cxxdiag_char_table, "q+#", NULL, + gcc_cxxdiag_flag_specs, gcc_cxxdiag_flag_pairs, + FMT_FLAG_ARG_CONVERT, +- 0, 0, 'p', 0, 'L', ++ 0, 0, 'p', 0, 'L', 0, + NULL, &integer_type_node + }, + { "gcc_gfc", NULL, gcc_gfc_char_table, "", NULL, + NULL, gcc_gfc_flag_pairs, + FMT_FLAG_ARG_CONVERT, +- 0, 0, 0, 0, 0, ++ 0, 0, 0, 0, 0, 0, + NULL, NULL + }, + { "scanf", scanf_length_specs, scan_char_table, "*'I", NULL, + scanf_flag_specs, scanf_flag_pairs, + FMT_FLAG_ARG_CONVERT|FMT_FLAG_SCANF_A_KLUDGE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_ZERO_WIDTH_BAD|FMT_FLAG_DOLLAR_GAP_POINTER_OK, +- 'w', 0, 0, '*', 'L', ++ 'w', 0, 0, '*', 'L', 'm', + NULL, NULL + }, + { "strftime", NULL, time_char_table, "_-0^#", "EO", + strftime_flag_specs, strftime_flag_pairs, +- FMT_FLAG_FANCY_PERCENT_OK, 'w', 0, 0, 0, 0, ++ FMT_FLAG_FANCY_PERCENT_OK, 'w', 0, 0, 0, 0, 0, + NULL, NULL + }, + { "strfmon", strfmon_length_specs, monetary_char_table, "=^+(!-", NULL, + strfmon_flag_specs, strfmon_flag_pairs, +- FMT_FLAG_ARG_CONVERT, 'w', '#', 'p', 0, 'L', ++ FMT_FLAG_ARG_CONVERT, 'w', '#', 'p', 0, 'L', 0, + NULL, NULL + } + }; +@@ -1462,7 +1464,7 @@ check_format_info_main (format_check_res + const format_length_info *fli = NULL; + const format_char_info *fci = NULL; + char flag_chars[256]; +- int aflag = 0; ++ int alloc_flag = 0; + const char *format_start = format_chars; + if (*format_chars == 0) + { +@@ -1721,6 +1723,31 @@ check_format_info_main (format_check_res + } + } + ++ if (fki->alloc_char && fki->alloc_char == *format_chars) ++ { ++ i = strlen (flag_chars); ++ flag_chars[i++] = fki->alloc_char; ++ flag_chars[i] = 0; ++ format_chars++; ++ } ++ ++ /* Handle the scanf allocation kludge. */ ++ if (fki->flags & (int) FMT_FLAG_SCANF_A_KLUDGE) ++ { ++ if (*format_chars == 'a' && !flag_isoc99) ++ { ++ if (format_chars[1] == 's' || format_chars[1] == 'S' ++ || format_chars[1] == '[') ++ { ++ /* 'a' is used as a flag. */ ++ i = strlen (flag_chars); ++ flag_chars[i++] = 'a'; ++ flag_chars[i] = 0; ++ format_chars++; ++ } ++ } ++ } ++ + /* Read any length modifier, if this kind of format has them. */ + fli = fki->length_char_specs; + length_chars = NULL; +@@ -1783,23 +1810,6 @@ check_format_info_main (format_check_res + } + } + +- /* Handle the scanf allocation kludge. */ +- if (fki->flags & (int) FMT_FLAG_SCANF_A_KLUDGE) +- { +- if (*format_chars == 'a' && !flag_isoc99) +- { +- if (format_chars[1] == 's' || format_chars[1] == 'S' +- || format_chars[1] == '[') +- { +- /* 'a' is used as a flag. */ +- i = strlen (flag_chars); +- flag_chars[i++] = 'a'; +- flag_chars[i] = 0; +- format_chars++; +- } +- } +- } +- + format_char = *format_chars; + if (format_char == 0 + || (!(fki->flags & (int) FMT_FLAG_FANCY_PERCENT_OK) +@@ -1872,7 +1882,9 @@ check_format_info_main (format_check_res + + if ((fki->flags & (int) FMT_FLAG_SCANF_A_KLUDGE) + && strchr (flag_chars, 'a') != 0) +- aflag = 1; ++ alloc_flag = 1; ++ if (fki->alloc_char && strchr (flag_chars, fki->alloc_char) != 0) ++ alloc_flag = 1; + + if (fki->suppression_char + && strchr (flag_chars, fki->suppression_char) != 0) +@@ -2044,13 +2056,13 @@ check_format_info_main (format_check_res + + wanted_type_ptr->wanted_type = wanted_type; + wanted_type_ptr->wanted_type_name = wanted_type_name; +- wanted_type_ptr->pointer_count = fci->pointer_count + aflag; ++ wanted_type_ptr->pointer_count = fci->pointer_count + alloc_flag; + wanted_type_ptr->char_lenient_flag = 0; + if (strchr (fci->flags2, 'c') != 0) + wanted_type_ptr->char_lenient_flag = 1; + wanted_type_ptr->writing_in_flag = 0; + wanted_type_ptr->reading_from_flag = 0; +- if (aflag) ++ if (alloc_flag) + wanted_type_ptr->writing_in_flag = 1; + else + { +--- gcc/config/sol2-c.c.jj 2007-02-20 22:39:11.000000000 +0100 ++++ gcc/config/sol2-c.c 2007-09-17 22:44:17.000000000 +0200 +@@ -74,7 +74,7 @@ const format_kind_info solaris_format_ty + { "cmn_err", cmn_err_length_specs, cmn_err_char_table, "", NULL, + cmn_err_flag_specs, cmn_err_flag_pairs, + FMT_FLAG_ARG_CONVERT|FMT_FLAG_EMPTY_PREC_OK, +- 'w', 0, 0, 0, 'L', ++ 'w', 0, 0, 0, 'L', 0, + &integer_type_node, &integer_type_node + } + }; +--- gcc/testsuite/gcc.dg/format/c90-scanf-5.c.jj 2007-09-17 22:44:17.000000000 +0200 ++++ gcc/testsuite/gcc.dg/format/c90-scanf-5.c 2007-09-17 22:44:17.000000000 +0200 +@@ -0,0 +1,19 @@ ++/* Test for scanf formats. Formats using extensions to the standard ++ should be rejected in strict pedantic mode. ++*/ ++/* { dg-do compile } */ ++/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */ ++ ++#include "format.h" ++ ++void ++foo (char **sp, wchar_t **lsp) ++{ ++ /* m assignment-allocation modifier, recognized in both C90 ++ and C99 modes, is a POSIX and ISO/IEC WDTR 24731-2 extension. */ ++ scanf ("%ms", sp); /* { dg-warning "C" "%ms" } */ ++ scanf ("%mS", lsp); /* { dg-warning "C" "%mS" } */ ++ scanf ("%mls", lsp); /* { dg-warning "C" "%mls" } */ ++ scanf ("%m[bcd]", sp); /* { dg-warning "C" "%m[]" } */ ++ scanf ("%ml[bcd]", lsp); /* { dg-warning "C" "%ml[]" } */ ++} +--- gcc/testsuite/gcc.dg/format/c99-scanf-4.c.jj 2007-09-17 22:44:17.000000000 +0200 ++++ gcc/testsuite/gcc.dg/format/c99-scanf-4.c 2007-09-17 22:44:17.000000000 +0200 +@@ -0,0 +1,19 @@ ++/* Test for scanf formats. Formats using extensions to the standard ++ should be rejected in strict pedantic mode. ++*/ ++/* { dg-do compile } */ ++/* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */ ++ ++#include "format.h" ++ ++void ++foo (char **sp, wchar_t **lsp) ++{ ++ /* m assignment-allocation modifier, recognized in both C90 ++ and C99 modes, is a POSIX and ISO/IEC WDTR 24731-2 extension. */ ++ scanf ("%ms", sp); /* { dg-warning "C" "%ms" } */ ++ scanf ("%mS", lsp); /* { dg-warning "C" "%mS" } */ ++ scanf ("%mls", lsp); /* { dg-warning "C" "%mls" } */ ++ scanf ("%m[bcd]", sp); /* { dg-warning "C" "%m[]" } */ ++ scanf ("%ml[bcd]", lsp); /* { dg-warning "C" "%ml[]" } */ ++} +--- gcc/testsuite/gcc.dg/format/ext-7.c.jj 2007-09-17 22:44:17.000000000 +0200 ++++ gcc/testsuite/gcc.dg/format/ext-7.c 2007-09-17 22:44:17.000000000 +0200 +@@ -0,0 +1,85 @@ ++/* Test for scanf formats. %a and %m extensions. */ ++/* { dg-do compile } */ ++/* { dg-options "-std=gnu89 -Wformat" } */ ++ ++#include "format.h" ++ ++void ++foo (char **sp, wchar_t **lsp, int *ip, float *fp, void **pp, double *dp) ++{ ++ /* %a formats for allocation, only recognized in C90 mode, are a ++ GNU extension. Followed by other characters, %a is not treated ++ specially. ++ */ ++ scanf ("%as", sp); ++ scanf ("%aS", lsp); ++ scanf ("%las", dp); ++ scanf ("%la", lsp); /* { dg-warning "but argument 2 has type" } */ ++ scanf ("%las", lsp); /* { dg-warning "but argument 2 has type" } */ ++ scanf ("%a[bcd]", sp); ++ scanf ("%la[bcd]", dp); ++ scanf ("%*as"); ++ scanf ("%*aS"); ++ scanf ("%*las"); /* { dg-warning "assignment suppression and length modifier" } */ ++ scanf ("%*a[bcd]"); ++ scanf ("%*la[bcd]"); /* { dg-warning "assignment suppression and length modifier" } */ ++ scanf ("%10as", sp); ++ scanf ("%5aS", lsp); ++ scanf ("%9las", dp); ++ scanf ("%25a[bcd]", sp); ++ scanf ("%48la[bcd]", dp); ++ scanf ("%*10as"); ++ scanf ("%*5aS"); ++ scanf ("%*9las"); /* { dg-warning "assignment suppression and length modifier" } */ ++ scanf ("%*25a[bcd]"); ++ scanf ("%*48la[bcd]"); /* { dg-warning "assignment suppression and length modifier" } */ ++ ++ /* m assignment-allocation modifier, recognized in both C90 ++ and C99 modes, is a POSIX and ISO/IEC WDTR 24731-2 extension. */ ++ scanf ("%ms", sp); ++ scanf ("%mS", lsp); ++ scanf ("%mls", lsp); ++ scanf ("%m[bcd]", sp); ++ scanf ("%ml[bcd]", lsp); ++ scanf ("%mc", sp); ++ scanf ("%mlc", lsp); ++ scanf ("%mC", lsp); ++ scanf ("%*ms"); ++ scanf ("%*mS"); ++ scanf ("%*mls"); /* { dg-warning "assignment suppression and length modifier" } */ ++ scanf ("%*m[bcd]"); ++ scanf ("%*ml[bcd]"); /* { dg-warning "assignment suppression and length modifier" } */ ++ scanf ("%*mc"); ++ scanf ("%*mlc"); /* { dg-warning "assignment suppression and length modifier" } */ ++ scanf ("%*mC"); ++ scanf ("%10ms", sp); ++ scanf ("%5mS", lsp); ++ scanf ("%9mls", lsp); ++ scanf ("%25m[bcd]", sp); ++ scanf ("%41ml[bcd]", lsp); ++ scanf ("%131mc", sp); ++ scanf ("%27mlc", lsp); ++ scanf ("%2mC", lsp); ++ scanf ("%*10ms"); ++ scanf ("%*5mS"); ++ scanf ("%*9mls"); /* { dg-warning "assignment suppression and length modifier" } */ ++ scanf ("%*25m[bcd]"); ++ scanf ("%*41ml[bcd]"); /* { dg-warning "assignment suppression and length modifier" } */ ++ scanf ("%*131mc"); ++ scanf ("%*27mlc"); /* { dg-warning "assignment suppression and length modifier" } */ ++ scanf ("%*2mC"); ++ ++ scanf ("%md", ip); /* { dg-warning "flag used with" } */ ++ scanf ("%mi", ip); /* { dg-warning "flag used with" } */ ++ scanf ("%mo", ip); /* { dg-warning "flag used with" } */ ++ scanf ("%mu", ip); /* { dg-warning "flag used with" } */ ++ scanf ("%mx", ip); /* { dg-warning "flag used with" } */ ++ scanf ("%me", fp); /* { dg-warning "flag used with" } */ ++ scanf ("%mf", fp); /* { dg-warning "flag used with" } */ ++ scanf ("%mg", fp); /* { dg-warning "flag used with" } */ ++ scanf ("%mp", pp); /* { dg-warning "flag used with" } */ ++ ++ scanf ("%mas", sp); /* { dg-warning "flag together" } */ ++ scanf ("%maS", lsp); /* { dg-warning "flag together" } */ ++ scanf ("%ma[bcd]", sp); /* { dg-warning "flag together" } */ ++} +--- gcc/testsuite/gcc.dg/format/ext-8.c.jj 2007-09-17 22:44:17.000000000 +0200 ++++ gcc/testsuite/gcc.dg/format/ext-8.c 2007-09-17 22:44:17.000000000 +0200 +@@ -0,0 +1,56 @@ ++/* Test for scanf formats. %m extensions. */ ++/* { dg-do compile } */ ++/* { dg-options "-std=gnu99 -Wformat" } */ ++ ++#include "format.h" ++ ++void ++foo (char **sp, wchar_t **lsp, int *ip, float *fp, void **pp) ++{ ++ /* m assignment-allocation modifier, recognized in both C90 ++ and C99 modes, is a POSIX and ISO/IEC WDTR 24731-2 extension. */ ++ scanf ("%ms", sp); ++ scanf ("%mS", lsp); ++ scanf ("%mls", lsp); ++ scanf ("%m[bcd]", sp); ++ scanf ("%ml[bcd]", lsp); ++ scanf ("%mc", sp); ++ scanf ("%mlc", lsp); ++ scanf ("%mC", lsp); ++ scanf ("%*ms"); ++ scanf ("%*mS"); ++ scanf ("%*mls"); /* { dg-warning "assignment suppression and length modifier" } */ ++ scanf ("%*m[bcd]"); ++ scanf ("%*ml[bcd]"); /* { dg-warning "assignment suppression and length modifier" } */ ++ scanf ("%*mc"); ++ scanf ("%*mlc"); /* { dg-warning "assignment suppression and length modifier" } */ ++ scanf ("%*mC"); ++ scanf ("%10ms", sp); ++ scanf ("%5mS", lsp); ++ scanf ("%9mls", lsp); ++ scanf ("%25m[bcd]", sp); ++ scanf ("%41ml[bcd]", lsp); ++ scanf ("%131mc", sp); ++ scanf ("%27mlc", lsp); ++ scanf ("%2mC", lsp); ++ scanf ("%*10ms"); ++ scanf ("%*5mS"); ++ scanf ("%*9mls"); /* { dg-warning "assignment suppression and length modifier" } */ ++ scanf ("%*25m[bcd]"); ++ scanf ("%*41ml[bcd]"); /* { dg-warning "assignment suppression and length modifier" } */ ++ scanf ("%*131mc"); ++ scanf ("%*27mlc"); /* { dg-warning "assignment suppression and length modifier" } */ ++ scanf ("%*2mC"); ++ ++ scanf ("%md", ip); /* { dg-warning "flag used with" } */ ++ scanf ("%mi", ip); /* { dg-warning "flag used with" } */ ++ scanf ("%mo", ip); /* { dg-warning "flag used with" } */ ++ scanf ("%mu", ip); /* { dg-warning "flag used with" } */ ++ scanf ("%mx", ip); /* { dg-warning "flag used with" } */ ++ scanf ("%ma", fp); /* { dg-warning "flag used with" } */ ++ scanf ("%mA", fp); /* { dg-warning "flag used with" } */ ++ scanf ("%me", fp); /* { dg-warning "flag used with" } */ ++ scanf ("%mf", fp); /* { dg-warning "flag used with" } */ ++ scanf ("%mg", fp); /* { dg-warning "flag used with" } */ ++ scanf ("%mp", pp); /* { dg-warning "flag used with" } */ ++} diff --git a/gcc41.spec b/gcc41.spec index cf24167..90c775c 100644 --- a/gcc41.spec +++ b/gcc41.spec @@ -1,6 +1,6 @@ %define DATE 20070821 %define gcc_version 4.1.2 -%define gcc_release 24 +%define gcc_release 25 %define _unpackaged_files_terminate_build 0 %define multilib_64_archs sparc64 ppc64 s390x x86_64 %define include_gappletviewer 1 @@ -152,6 +152,8 @@ Patch35: gcc41-builtin-throw.patch Patch36: gcc41-builtin-va-arg-pack.patch Patch37: gcc41-builtin-va-arg-pack-len.patch Patch38: gcc41-pr27954.patch +Patch39: gcc41-pr33423.patch +Patch40: gcc41-scanf-fmt-check.patch # On ARM EABI systems, we do want -gnueabi to be part of the # target triple. @@ -473,6 +475,8 @@ which are required to run programs compiled with the GNAT. %patch36 -p0 -b .builtin-va-arg-pack~ %patch37 -p0 -b .builtin-va-arg-pack-len~ %patch38 -p0 -b .pr27954~ +%patch39 -p0 -b .pr33423~ +%patch40 -p0 -b .scanf-fmt-check~ sed -i -e 's/4\.1\.3/4.1.2/' gcc/BASE-VER gcc/version.c sed -i -e 's/" (Red Hat[^)]*)"/" (Red Hat %{version}-%{gcc_release})"/' gcc/version.c @@ -1627,6 +1631,12 @@ fi %doc rpm.doc/changelogs/libmudflap/ChangeLog* %changelog +* Mon Sep 17 2007 Jakub Jelinek 4.1.2-25 +- fix ICE on __builtin_mem*_chk if it couldn't be folded until + expand time and at that point it can avoid a call (PR middle-end/33423) +- handle the upcoming POSIX 'm' *scanf allocation modifier in + GCC format checking, fix up some details about %as/%aS/%a[ + * Fri Sep 14 2007 Jakub Jelinek 4.1.2-24 - backport __builtin_va_arg_pack_len () support - fix Fortran error recovery with DATA (Jerry DeLisle, #281331,