public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/18180] New: Disable special handling of functions with --freestanding
@ 2004-10-27 14:37 alex dot neyman at auriga dot ru
2004-10-27 14:38 ` [Bug c/18180] " alex dot neyman at auriga dot ru
` (9 more replies)
0 siblings, 10 replies; 14+ messages in thread
From: alex dot neyman at auriga dot ru @ 2004-10-27 14:37 UTC (permalink / raw)
To: gcc-bugs
The documentation on GCC states that in freestanding environment, no
assumptions are made:
========
To make it act as a conforming freestanding
implementation for a freestanding environment, use the option
`-ffreestanding'; it will then define `__STDC_HOSTED__' to `0' and not
make assumptions about the meanings of function names from the standard
library
========
However, a simple testcase shows that
- different code is generated for function issuing the setjmp() call and any
other function call in freestanding env (actually, the code for a function
using setjmp() is the same both in hosted and freestanding env).
- The 'variable might be clobbered' warning is emitted for setjmp() call even
in freestanding env
Try compiling the test case with the following flags:
*1) gcc -DSETJMP=setjmp -ffreestanding -s ff.c
*2) gcc -DSETJMP=setjmp -fhosted -s ff.c
*3) gcc -DSETJMP=mysetjmp -ffreestanding -s ff.c
and compare the output. *1 and *2 give the same output, which differs from *3.
--
Summary: Disable special handling of functions with --
freestanding
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: alex dot neyman at auriga dot ru
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18180
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/18180] Disable special handling of functions with --freestanding
2004-10-27 14:37 [Bug c/18180] New: Disable special handling of functions with --freestanding alex dot neyman at auriga dot ru
@ 2004-10-27 14:38 ` alex dot neyman at auriga dot ru
2004-10-27 14:55 ` alex dot neyman at auriga dot ru
` (8 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: alex dot neyman at auriga dot ru @ 2004-10-27 14:38 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From alex dot neyman at auriga dot ru 2004-10-27 14:38 -------
Created an attachment (id=7416)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7416&action=view)
The test case
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18180
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/18180] Disable special handling of functions with --freestanding
2004-10-27 14:37 [Bug c/18180] New: Disable special handling of functions with --freestanding alex dot neyman at auriga dot ru
2004-10-27 14:38 ` [Bug c/18180] " alex dot neyman at auriga dot ru
@ 2004-10-27 14:55 ` alex dot neyman at auriga dot ru
2004-10-27 14:56 ` alex dot neyman at auriga dot ru
` (7 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: alex dot neyman at auriga dot ru @ 2004-10-27 14:55 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From alex dot neyman at auriga dot ru 2004-10-27 14:55 -------
Created an attachment (id=7418)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7418&action=view)
Proposed patch
The patch, however, leads to a build failure:
optabs.h and c-common.h have a clash with CTI_MAX enumeration value.
Patch was tested by rename with CTI_MAX in optabs.[ch] renamed to CTI_max.
(not regression-tested, though). The resulting assembly is the same in *2 and
*3, and differs from *1. No "might be clobbered" warnings are generated
in -freestanding mode.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18180
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/18180] Disable special handling of functions with --freestanding
2004-10-27 14:37 [Bug c/18180] New: Disable special handling of functions with --freestanding alex dot neyman at auriga dot ru
2004-10-27 14:38 ` [Bug c/18180] " alex dot neyman at auriga dot ru
2004-10-27 14:55 ` alex dot neyman at auriga dot ru
@ 2004-10-27 14:56 ` alex dot neyman at auriga dot ru
2004-10-27 15:00 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: alex dot neyman at auriga dot ru @ 2004-10-27 14:56 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From alex dot neyman at auriga dot ru 2004-10-27 14:56 -------
Just to make it clear: this test case never produces "variable might be
clobbered" warning, another test case was used for that.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18180
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/18180] Disable special handling of functions with --freestanding
2004-10-27 14:37 [Bug c/18180] New: Disable special handling of functions with --freestanding alex dot neyman at auriga dot ru
` (2 preceding siblings ...)
2004-10-27 14:56 ` alex dot neyman at auriga dot ru
@ 2004-10-27 15:00 ` pinskia at gcc dot gnu dot org
2004-10-27 15:09 ` alex dot neyman at auriga dot ru
` (5 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-27 15:00 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-10-27 15:00 -------
Try with -fno-builtins.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18180
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/18180] Disable special handling of functions with --freestanding
2004-10-27 14:37 [Bug c/18180] New: Disable special handling of functions with --freestanding alex dot neyman at auriga dot ru
` (3 preceding siblings ...)
2004-10-27 15:00 ` pinskia at gcc dot gnu dot org
@ 2004-10-27 15:09 ` alex dot neyman at auriga dot ru
2004-10-27 15:39 ` jsm at polyomino dot org dot uk
` (4 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: alex dot neyman at auriga dot ru @ 2004-10-27 15:09 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From alex dot neyman at auriga dot ru 2004-10-27 15:09 -------
Tried, the result of "-ffreestanding -fno-builtin" is the same as just
"-ffreestanding". Also, IIRC -ffreestanding implies -fno-builtin, doesn't it?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18180
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/18180] Disable special handling of functions with --freestanding
2004-10-27 14:37 [Bug c/18180] New: Disable special handling of functions with --freestanding alex dot neyman at auriga dot ru
` (4 preceding siblings ...)
2004-10-27 15:09 ` alex dot neyman at auriga dot ru
@ 2004-10-27 15:39 ` jsm at polyomino dot org dot uk
2004-10-27 16:01 ` alex dot neyman at auriga dot ru
` (3 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: jsm at polyomino dot org dot uk @ 2004-10-27 15:39 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jsm at polyomino dot org dot uk 2004-10-27 15:39 -------
Subject: Re: New: Disable special handling of functions with
--freestanding
On Wed, 27 Oct 2004, alex dot neyman at auriga dot ru wrote:
> - different code is generated for function issuing the setjmp() call and any
> other function call in freestanding env (actually, the code for a function
> using setjmp() is the same both in hosted and freestanding env).
The bug would be that special_function_p checks function names at all.
We have at least three different methods of applying special properties to
functions based on their names: built-in functions with attributes,
special_function_f and cp/cfns.gperf. We should subsume the latter two in
the first. See projects/beginner.html. The special handling may be
needed to generate correct code in some cases such as setjmp, so disabling
the special handling without first having an attribute allowing it to be
reenabled for particular declarations is not a good solution.
I would advise following the usual procedures for contributing (see
contribute.html) to discuss the issues on gcc-patches and work through
getting a patch for bug 14411 into GCC. That is necessary to solve the
issues for bug 14411. It would be best to do a series of patches, one for
each attribute (discussed and revised as necessary) followed by one
replacing the special_function_p handling with use of that attribute
(including fixincludes work as necessary).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18180
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/18180] Disable special handling of functions with --freestanding
2004-10-27 14:37 [Bug c/18180] New: Disable special handling of functions with --freestanding alex dot neyman at auriga dot ru
` (5 preceding siblings ...)
2004-10-27 15:39 ` jsm at polyomino dot org dot uk
@ 2004-10-27 16:01 ` alex dot neyman at auriga dot ru
2004-10-27 17:05 ` jsm at polyomino dot org dot uk
` (2 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: alex dot neyman at auriga dot ru @ 2004-10-27 16:01 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From alex dot neyman at auriga dot ru 2004-10-27 16:01 -------
The bug 14411 was submitted by me as well, though from a different email
address. I updated the patch in it to apply to 4.0.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18180
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/18180] Disable special handling of functions with --freestanding
2004-10-27 14:37 [Bug c/18180] New: Disable special handling of functions with --freestanding alex dot neyman at auriga dot ru
` (6 preceding siblings ...)
2004-10-27 16:01 ` alex dot neyman at auriga dot ru
@ 2004-10-27 17:05 ` jsm at polyomino dot org dot uk
2004-10-29 17:38 ` [Bug c/18180] move special handling out functions into attributes pinskia at gcc dot gnu dot org
2005-01-28 6:28 ` pinskia at gcc dot gnu dot org
9 siblings, 0 replies; 14+ messages in thread
From: jsm at polyomino dot org dot uk @ 2004-10-27 17:05 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jsm at polyomino dot org dot uk 2004-10-27 17:05 -------
Subject: Re: Disable special handling of functions with
--freestanding
On Wed, 27 Oct 2004, alex dot neyman at auriga dot ru wrote:
> The bug 14411 was submitted by me as well, though from a different email
> address. I updated the patch in it to apply to 4.0.
You will need to *send the patch to gcc-patches* for reviewers to look at
it, and iterate as necessary until a version is approved. See the full
instructions at <http://gcc.gnu.org/contribute.html> first. You will need
to include testcases in the patch, and I suggest naming the setjmp
attribute something like returns_twice - make it general so it can handle
vfork as well. If you don't have the copyright assignment paperwork on
file yet, start getting it in now. I don't know whether the present patch
will require it, but a series of successive patches along those lines
will.
++ @code{unused}, @code{deprecated}, @code{weak}, @code{malloc}, @code{setjmp},
++ @code{longjmp}, @code{alias}, and @code{nonnull}. Several other attributes
++ are defined for functions on particular target systems. Other attributes,
++ including @code{section} are supported for variables declarations
in your patch looks wrong; why add the lines beginning with an extra "+"?
You need two spaces after a "." at the end of a sentence in Texinfo.
K&R-style function definitions are no longer used in GCC.
When adding flags to tree_decl you need to update the comment lower down
about how many spare bits there are (before another 32-bit word would be
used). Note the flags are listed grouped into bytes in the declaration.
`%s' quoting is no longer used in GCC; you should use %qs instead.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18180
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/18180] move special handling out functions into attributes
2004-10-27 14:37 [Bug c/18180] New: Disable special handling of functions with --freestanding alex dot neyman at auriga dot ru
` (7 preceding siblings ...)
2004-10-27 17:05 ` jsm at polyomino dot org dot uk
@ 2004-10-29 17:38 ` pinskia at gcc dot gnu dot org
2005-01-28 6:28 ` pinskia at gcc dot gnu dot org
9 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-29 17:38 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |diagnostic, wrong-code
Last reconfirmed|0000-00-00 00:00:00 |2004-10-29 17:38:20
date| |
Summary|Disable special handling of |move special handling out
|functions with -- |functions into attributes
|freestanding |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18180
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/18180] move special handling out functions into attributes
2004-10-27 14:37 [Bug c/18180] New: Disable special handling of functions with --freestanding alex dot neyman at auriga dot ru
` (8 preceding siblings ...)
2004-10-29 17:38 ` [Bug c/18180] move special handling out functions into attributes pinskia at gcc dot gnu dot org
@ 2005-01-28 6:28 ` pinskia at gcc dot gnu dot org
9 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-28 6:28 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2004-10-29 17:38:20 |2005-01-28 06:28:44
date| |
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18180
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/18180] move special handling out functions into attributes
[not found] <bug-18180-4@http.gcc.gnu.org/bugzilla/>
2021-08-13 23:11 ` pinskia at gcc dot gnu.org
@ 2022-02-26 2:51 ` egallager at gcc dot gnu.org
1 sibling, 0 replies; 14+ messages in thread
From: egallager at gcc dot gnu.org @ 2022-02-26 2:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18180
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
CC| |egallager at gcc dot gnu.org
--- Comment #10 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #9)
> I think this is all fixed with the patch for PR 71876.
ok, closing as FIXED then
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/18180] move special handling out functions into attributes
[not found] <bug-18180-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-13 23:11 ` pinskia at gcc dot gnu.org
2022-02-26 2:51 ` egallager at gcc dot gnu.org
1 sibling, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-13 23:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18180
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think this is all fixed with the patch for PR 71876.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/18180] move special handling out functions into attributes
[not found] <bug-18180-319@http.gcc.gnu.org/bugzilla/>
@ 2005-10-04 13:19 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-04 13:19 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.1.0 |---
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18180
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2022-02-26 2:51 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-27 14:37 [Bug c/18180] New: Disable special handling of functions with --freestanding alex dot neyman at auriga dot ru
2004-10-27 14:38 ` [Bug c/18180] " alex dot neyman at auriga dot ru
2004-10-27 14:55 ` alex dot neyman at auriga dot ru
2004-10-27 14:56 ` alex dot neyman at auriga dot ru
2004-10-27 15:00 ` pinskia at gcc dot gnu dot org
2004-10-27 15:09 ` alex dot neyman at auriga dot ru
2004-10-27 15:39 ` jsm at polyomino dot org dot uk
2004-10-27 16:01 ` alex dot neyman at auriga dot ru
2004-10-27 17:05 ` jsm at polyomino dot org dot uk
2004-10-29 17:38 ` [Bug c/18180] move special handling out functions into attributes pinskia at gcc dot gnu dot org
2005-01-28 6:28 ` pinskia at gcc dot gnu dot org
[not found] <bug-18180-319@http.gcc.gnu.org/bugzilla/>
2005-10-04 13:19 ` pinskia at gcc dot gnu dot org
[not found] <bug-18180-4@http.gcc.gnu.org/bugzilla/>
2021-08-13 23:11 ` pinskia at gcc dot gnu.org
2022-02-26 2:51 ` egallager at gcc dot gnu.org
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).