From: Zack Weinberg Date: Sat, 28 Sep 2002 00:32:16 +0000 (+0000) Subject: re PR preprocessor/8055 (PATCH: cpp0 dies with SIG11 when building FreeBSD kernel) X-Git-Tag: releases/gcc-3.2.1~233 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2603a9647ea78bffb0c2a3dc2b905ae51abfc17;p=thirdparty%2Fgcc.git re PR preprocessor/8055 (PATCH: cpp0 dies with SIG11 when building FreeBSD kernel) 2002-09-27 Alexander N. Kabaev PR preprocessor/8055 * cppmacro.c (stringify_arg): Do not overflow the buffer with the terminating NUL when the argument to be stringified has no tokens. * gcc.dg/cpp/20020927-1.c: New. From-SVN: r57601 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 017f50cae7bd..b7265898d51b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2002-09-27 Alexander N. Kabaev + + PR preprocessor/8055 + * cppmacro.c (stringify_arg): Do not overflow the buffer + with the terminating NUL when the argument to be stringified + has no tokens. + 2002-09-26 David S. Miller PR optimization/7335 @@ -60,7 +67,7 @@ 2002-09-16 Jeff Law - * libgcc2.c: Do not include machmode.h. + * libgcc2.c: Do not include machmode.h. 2002-09-16 Jason Merrill Danny Smith @@ -256,7 +263,7 @@ 2002-08-27 Mark Mitchell * doc/invoke.texi: Document -Wabi. - + 2002-08-23 David Edelsohn * config/rs6000/rs6000.c (rs6000_select_section): Treat @@ -272,7 +279,7 @@ * explow.c (expr_size): Call it. (int_expr_size): New fn. * expr.h: Declare it. - * expr.c (expand_expr) [CONSTRUCTOR]: Use it to calculate how + * expr.c (expand_expr) [CONSTRUCTOR]: Use it to calculate how much to store. 2002-08-23 Alan Modra diff --git a/gcc/cppmacro.c b/gcc/cppmacro.c index c85ac21cce14..70e52fda6e86 100644 --- a/gcc/cppmacro.c +++ b/gcc/cppmacro.c @@ -348,6 +348,12 @@ stringify_arg (pfile, arg) } /* Commit the memory, including NUL, and return the token. */ + if ((size_t) (BUFF_LIMIT (pfile->u_buff) - dest) < 1) + { + size_t len_so_far = dest - BUFF_FRONT (pfile->u_buff); + _cpp_extend_buff (pfile, &pfile->u_buff, 1); + dest = BUFF_FRONT (pfile->u_buff) + len_so_far; + } len = dest - BUFF_FRONT (pfile->u_buff); BUFF_FRONT (pfile->u_buff) = dest + 1; return new_string_token (pfile, dest - len, len); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9ce660a6b48d..26209dfda19f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,8 +1,13 @@ +2002-09-27 Zack Weinberg + + * gcc.dg/cpp/20020927-1.c: New. + 2002-09-26 David S. Miller * gcc.c-torture/compile/trunctfdf.c: New. 2002-09-26 Kaveh R. Ghazi + * lib/target-supports.exp (check_weak_available): Handle solaris2. 2002-09-27 Alan Modra @@ -37,7 +42,7 @@ * testsuite/g++.dg/abi/bitfield5.C: New test. * testsuite/g++.dg/abi/vbase10.C: Likewise. - + 2002-08-15 Neil Booth * gcc.dg/cpp/_Pragma3.c, gcc.dg/cpp/vararg3.c, gcc.dg/cpp/vararg4.c: @@ -92,7 +97,7 @@ PR c++/7224 * g++.dg/overload/error1.C: New test. - + 2002-07-03 Mark Mitchell PR c++/6706 @@ -602,8 +607,8 @@ 2002-03-26 Richard Henderson - * gcc.c-torture/execute/20020307-2.c (main): Pass a variable sized - structure. + * gcc.c-torture/execute/20020307-2.c (main): Pass a variable sized + structure. 2002-03-26 David Billinghurst @@ -853,7 +858,7 @@ Sat Mar 9 07:30:53 2002 Richard Kenner 2002-02-21 Aldy Hernandez - * gcc.dg/attr-alwaysinline.c: New. + * gcc.dg/attr-alwaysinline.c: New. 2002-02-21 Jakub Jelinek @@ -930,7 +935,7 @@ Sat Mar 9 07:30:53 2002 Richard Kenner 2002-02-13 Stan Shebs - * gcc.dg/altivec-3.c: New. + * gcc.dg/altivec-3.c: New. 2002-02-12 Jakub Jelinek @@ -1036,13 +1041,13 @@ Sat Mar 9 07:30:53 2002 Richard Kenner 2002-02-06 Nick Clifton * g++.dg/ext/align1.C: Do not use an explicit alignment value - as certain file formats cannot support particularly large - alignments. + as certain file formats cannot support particularly large + alignments. * g++.dg/warn/weak1.C: Expect a warning from COFF toolchains, and do not expect to be able to link the executable. - * g++.old-deja/g++.ext/attrib5.C: Expect the compilation to + * g++.old-deja/g++.ext/attrib5.C: Expect the compilation to fail because the COFF format does not support the weak attribute. 2002-02-05 David Billinghurst @@ -1051,8 +1056,8 @@ Sat Mar 9 07:30:53 2002 Richard Kenner 2002-02-05 Aldy Hernandez - * gcc.dg/altivec-4.c: AltiVec builtin predicates changed format. - Fix testcase accordingly. + * gcc.dg/altivec-4.c: AltiVec builtin predicates changed format. + Fix testcase accordingly. 2002-02-04 Richard Henderson diff --git a/gcc/testsuite/gcc.dg/cpp/20020927-1.c b/gcc/testsuite/gcc.dg/cpp/20020927-1.c index 91f89518a22c..bcbdaf800b18 100644 --- a/gcc/testsuite/gcc.dg/cpp/20020927-1.c +++ b/gcc/testsuite/gcc.dg/cpp/20020927-1.c @@ -60,7 +60,10 @@ S(1234567890123456789012345678901234567890123456789012345678901234567890 1234567890123456789012345678901234567890123456789012345678901234567890 1234567890123456789012345678901234567890123456789012345678901234567890 1234567890123456789012345678901234567890123456789012345678901234567890 - 12345678901234567890123456789012345678901234567890123456789012345) + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 12345678901234567890123456789012345678901234567890123) /* When stringify_arg() was called with an empty macro argument, it would advance the buffer pointer by one but fail to check for running past the