Temporary source files created by the selftests weren't generated
correctly if they contained a "%" character (seen whilst writing
selftests for the locations-within-string-literals patch I'm
working on).

Root cause was a buggy fprintf in the selftest::temp_source_file ctor.

Fixed thusly.

Successfully bootstrapped&regrtested on x86_64-pc-linux-gnu;
committed to trunk (as r238732), under the "obvious" rule.

gcc/ChangeLog:
        * input.c (selftest::temp_source_file::temp_source_file): Fix
        missing "%s" in fprintf.
---
 gcc/input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/input.c b/gcc/input.c
index a916597..47845d00 100644
--- a/gcc/input.c
+++ b/gcc/input.c
@@ -1175,7 +1175,7 @@ temp_source_file::temp_source_file (const location &loc, 
const char *suffix,
   if (!out)
     ::selftest::fail_formatted (loc, "unable to open tempfile: %s",
                                m_filename);
-  fprintf (out, content);
+  fprintf (out, "%s", content);
   fclose (out);
 }
 
-- 
1.8.5.3

Reply via email to