public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/17402] New: static functions are removed before builtins are expanded
@ 2004-09-10 17:23 phython at gcc dot gnu dot org
  2004-09-10 17:25 ` [Bug c/17402] " phython at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: phython at gcc dot gnu dot org @ 2004-09-10 17:23 UTC (permalink / raw)
  To: gcc-bugs

The sprintf builtin is transformed into a strcpy if it is possible.  This is a
problem if strcpy is a static inline function.  The following testcase will have
a call to strcpy without using the strcpy in the source file.

-- 
           Summary: static functions are removed before builtins are
                    expanded
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: phython at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: ppc-linux-gnu, i386-linux-gnu
  GCC host triplet: ppc-linux-gnu, i386-linux-gnu
GCC target triplet: ppc-linux-gnu, i386-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17402


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c/17402] static functions are removed before builtins are expanded
  2004-09-10 17:23 [Bug c/17402] New: static functions are removed before builtins are expanded phython at gcc dot gnu dot org
@ 2004-09-10 17:25 ` phython at gcc dot gnu dot org
  2004-09-10 18:58 ` sfllaw at debian dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: phython at gcc dot gnu dot org @ 2004-09-10 17:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From phython at gcc dot gnu dot org  2004-09-10 17:25 -------
Created an attachment (id=7088)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7088&action=view)
testcase


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17402


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c/17402] static functions are removed before builtins are expanded
  2004-09-10 17:23 [Bug c/17402] New: static functions are removed before builtins are expanded phython at gcc dot gnu dot org
  2004-09-10 17:25 ` [Bug c/17402] " phython at gcc dot gnu dot org
@ 2004-09-10 18:58 ` sfllaw at debian dot org
  2004-09-10 22:04 ` [Bug middle-end/17402] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: sfllaw at debian dot org @ 2004-09-10 18:58 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sfllaw at debian dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17402


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug middle-end/17402] [3.4/4.0 Regression] static functions are removed before builtins are expanded
  2004-09-10 17:23 [Bug c/17402] New: static functions are removed before builtins are expanded phython at gcc dot gnu dot org
  2004-09-10 17:25 ` [Bug c/17402] " phython at gcc dot gnu dot org
  2004-09-10 18:58 ` sfllaw at debian dot org
@ 2004-09-10 22:04 ` pinskia at gcc dot gnu dot org
  2004-09-13  6:01 ` rth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-10 22:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-10 22:04 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c                           |middle-end
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
      Known to fail|                            |4.0.0 3.4.0
      Known to work|                            |3.3.3
   Last reconfirmed|0000-00-00 00:00:00         |2004-09-10 22:04:44
               date|                            |
            Summary|static functions are removed|[3.4/4.0 Regression] static
                   |before builtins are expanded|functions are removed before
                   |                            |builtins are expanded
   Target Milestone|---                         |3.4.3


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17402


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug middle-end/17402] [3.4/4.0 Regression] static functions are removed before builtins are expanded
  2004-09-10 17:23 [Bug c/17402] New: static functions are removed before builtins are expanded phython at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-09-10 22:04 ` [Bug middle-end/17402] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2004-09-13  6:01 ` rth at gcc dot gnu dot org
  2004-09-28 13:33 ` [Bug middle-end/17402] " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-09-13  6:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2004-09-13 06:01 -------
Not wrong-code.  Without -ffreestanding, i.e. in a hosted environment, the
compiler is allowed to assume that the entire standard C library is present.
Thus an external call to strcpy is legal.

So I've changed this to an enhancement request.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
           Keywords|wrong-code                  |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17402


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug middle-end/17402] static functions are removed before builtins are expanded
  2004-09-10 17:23 [Bug c/17402] New: static functions are removed before builtins are expanded phython at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-09-13  6:01 ` rth at gcc dot gnu dot org
@ 2004-09-28 13:33 ` pinskia at gcc dot gnu dot org
  2004-10-03 17:31 ` phython at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-28 13:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-28 13:33 -------
Removing regression as this is really an enhancement.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[3.4/4.0 Regression] static |static functions are removed
                   |functions are removed before|before builtins are expanded
                   |builtins are expanded       |
   Target Milestone|3.4.3                       |---


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17402


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug middle-end/17402] static functions are removed before builtins are expanded
  2004-09-10 17:23 [Bug c/17402] New: static functions are removed before builtins are expanded phython at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-09-28 13:33 ` [Bug middle-end/17402] " pinskia at gcc dot gnu dot org
@ 2004-10-03 17:31 ` phython at gcc dot gnu dot org
  2004-10-03 19:19 ` jsm at polyomino dot org dot uk
  2005-08-23  6:29 ` phython at gcc dot gnu dot org
  7 siblings, 0 replies; 11+ messages in thread
From: phython at gcc dot gnu dot org @ 2004-10-03 17:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From phython at gcc dot gnu dot org  2004-10-03 17:31 -------
 Ok, so I took a look at this on mainline.  What happens is sprintf is folded
into __builtin_strcpy.  All the tree optimizers run, strcpy is removed and a
call to __builtin_strcpy is still around.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17402


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug middle-end/17402] static functions are removed before builtins are expanded
  2004-09-10 17:23 [Bug c/17402] New: static functions are removed before builtins are expanded phython at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-10-03 17:31 ` phython at gcc dot gnu dot org
@ 2004-10-03 19:19 ` jsm at polyomino dot org dot uk
  2005-08-23  6:29 ` phython at gcc dot gnu dot org
  7 siblings, 0 replies; 11+ messages in thread
From: jsm at polyomino dot org dot uk @ 2004-10-03 19:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jsm at polyomino dot org dot uk  2004-10-03 19:19 -------
Subject: Re:  static functions are removed before
 builtins are expanded

On Sun, 3 Oct 2004, phython at gcc dot gnu dot org wrote:

>  Ok, so I took a look at this on mainline.  What happens is sprintf is folded
> into __builtin_strcpy.  All the tree optimizers run, strcpy is removed and a
> call to __builtin_strcpy is still around.

It would in fact be *wrong* ever to generate a call to a static definition 
of strcpy in such a case; even if the local static strcpy weren't removed, 
calling it rather than the external strcpy from sprintf is wrong.  Though 
strcpy is reserved with external linkage, it is only reserved at file 
scope (e.g. as a static function) if <string.h> is included.  If built-in 
function calls can generate calls to file-scope statics, then that is a 
bug.



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17402


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug middle-end/17402] static functions are removed before builtins are expanded
  2004-09-10 17:23 [Bug c/17402] New: static functions are removed before builtins are expanded phython at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2004-10-03 19:19 ` jsm at polyomino dot org dot uk
@ 2005-08-23  6:29 ` phython at gcc dot gnu dot org
  7 siblings, 0 replies; 11+ messages in thread
From: phython at gcc dot gnu dot org @ 2005-08-23  6:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From phython at gcc dot gnu dot org  2005-08-23 06:06 -------
 I don't care about this anymore.  Perhaps this should be an invalid bug, oh well.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17402


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug middle-end/17402] static functions are removed before builtins are expanded
       [not found] <bug-17402-7737@http.gcc.gnu.org/bugzilla/>
  2006-09-21  6:06 ` pinskia at gcc dot gnu dot org
@ 2006-09-21  6:18 ` acahalan at gmail dot com
  1 sibling, 0 replies; 11+ messages in thread
From: acahalan at gmail dot com @ 2006-09-21  6:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from acahalan at gmail dot com  2006-09-21 06:18 -------
Regarding comment #3, why is -fwhole-program accepted without -ffreestanding?

Unlike the original poster (who wrote "I don't care about this anymore."),
this is a rather annoying bug for me. I'll check again tomorrow, but I recall
that something else broke with -ffreestanding. I really don't think it is right
to close out a bug as a dupe against one which the original reporter has lost
all interest in.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17402


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug middle-end/17402] static functions are removed before builtins are expanded
       [not found] <bug-17402-7737@http.gcc.gnu.org/bugzilla/>
@ 2006-09-21  6:06 ` pinskia at gcc dot gnu dot org
  2006-09-21  6:18 ` acahalan at gmail dot com
  1 sibling, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-21  6:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gcc dot gnu dot org  2006-09-21 06:05 -------
*** Bug 29159 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |acahalan at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17402


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2006-09-21  6:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-10 17:23 [Bug c/17402] New: static functions are removed before builtins are expanded phython at gcc dot gnu dot org
2004-09-10 17:25 ` [Bug c/17402] " phython at gcc dot gnu dot org
2004-09-10 18:58 ` sfllaw at debian dot org
2004-09-10 22:04 ` [Bug middle-end/17402] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
2004-09-13  6:01 ` rth at gcc dot gnu dot org
2004-09-28 13:33 ` [Bug middle-end/17402] " pinskia at gcc dot gnu dot org
2004-10-03 17:31 ` phython at gcc dot gnu dot org
2004-10-03 19:19 ` jsm at polyomino dot org dot uk
2005-08-23  6:29 ` phython at gcc dot gnu dot org
     [not found] <bug-17402-7737@http.gcc.gnu.org/bugzilla/>
2006-09-21  6:06 ` pinskia at gcc dot gnu dot org
2006-09-21  6:18 ` acahalan at gmail dot com

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).