public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: nick <xerofoify@gmail.com>
To: GCC Development <gcc@gcc.gnu.org>
Subject: Warning in gcc/libiberty/dyn-string.c during build
Date: Sun, 24 Mar 2019 03:49:00 -0000	[thread overview]
Message-ID: <ba0c56f7-2d35-d3f5-d706-98cb11fcc205@gmail.com> (raw)

Greetings all,
I just got this in my build output:
ar: `u' modifier ignored since `D' is the default (see `U')                                                                                                                    
configure: WARNING: cannot check for properly working vsnprintf when cross compiling, will assume it's ok                                                                      
../../gcc/libiberty/dyn-string.c: In function ‘dyn_string_insert_cstr’:                                                                                                        
 ../../gcc/libiberty/dyn-string.c:280:3: warning: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]   
 strncpy (dest->s + pos, src, length);                                                                                                                                
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                 
 ../../gcc/libiberty/dyn-string.c:272:16: note: length computed here                                                                                                            
272 |   int length = strlen (src);                                                                                                                                           
|                ^~~~~~~~~~~~                                                                                                                                            
 ../../gcc/libiberty/dyn-string.c: In function ‘dyn_string_insert_cstr’:                                                                                                        
\ ../../gcc/libiberty/dyn-string.c:280:3: warning: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]   
280 |   strncpy (dest->s + pos, src, length);                                                                                                                                
|   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                 
 ../../gcc/libiberty/dyn-string.c:272:16: note: length computed here                                                                                                            
272 |   int length = strlen (src);                                                                                                                                           
|                ^~~~~~~~~~~~    

I've already looked through git blame and it seems this code was last touched in 2000. That warning seems
to be  new to gcc 8 after a little research so is this a rather old bug that was not found and very
subtle or is this a mislabel. Seems to be a mislabel to me but I'm new to the code base so just thought
I would ask.

Cheers,
Nick

             reply	other threads:[~2019-03-24  3:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-24  3:49 nick [this message]
2019-03-25 16:39 ` Martin Sebor
2019-03-25 19:45   ` Jeff Law
2019-03-25 21:39     ` nick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ba0c56f7-2d35-d3f5-d706-98cb11fcc205@gmail.com \
    --to=xerofoify@gmail.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).