public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/29305] local label-as-value being placed before function prolog
       [not found] <bug-29305-4@http.gcc.gnu.org/bugzilla/>
@ 2021-01-30 12:18 ` stsp at users dot sourceforge.net
  2024-03-16 18:09 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 10+ messages in thread
From: stsp at users dot sourceforge.net @ 2021-01-30 12:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=29305

Stas Sergeev <stsp at users dot sourceforge.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stsp at users dot sourceforge.net

--- Comment #11 from Stas Sergeev <stsp at users dot sourceforge.net> ---
Just for a heads-up.
The solution to that problem was suggested here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98896#c7

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

* [Bug middle-end/29305] local label-as-value being placed before function prolog
       [not found] <bug-29305-4@http.gcc.gnu.org/bugzilla/>
  2021-01-30 12:18 ` [Bug middle-end/29305] local label-as-value being placed before function prolog stsp at users dot sourceforge.net
@ 2024-03-16 18:09 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-16 18:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=29305

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INVALID                     |DUPLICATE

--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> ---


*** This bug has been marked as a duplicate of bug 44298 ***

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

* [Bug middle-end/29305] local label-as-value being placed before function prolog
  2006-10-01  4:33 [Bug c/29305] New: " jeremy at goop dot org
                   ` (6 preceding siblings ...)
  2006-10-01  6:24 ` pinskia at gcc dot gnu dot org
@ 2006-10-01  8:47 ` jeremy at goop dot org
  7 siblings, 0 replies; 10+ messages in thread
From: jeremy at goop dot org @ 2006-10-01  8:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from jeremy at goop dot org  2006-10-01 08:47 -------
>In fact if GCC changes the behavior,
>it would be for the worse as then people using them correctly would be
>punished.

How so?


-- 


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


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

* [Bug middle-end/29305] local label-as-value being placed before function prolog
  2006-10-01  4:33 [Bug c/29305] New: " jeremy at goop dot org
                   ` (5 preceding siblings ...)
  2006-10-01  6:00 ` jeremy at goop dot org
@ 2006-10-01  6:24 ` pinskia at gcc dot gnu dot org
  2006-10-01  8:47 ` jeremy at goop dot org
  7 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-10-01  6:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pinskia at gcc dot gnu dot org  2006-10-01 06:24 -------
(In reply to comment #8)
> Reopen as enhancement, in the hope gcc implements more useful semantics for
> taking the address of a label.
They are useful if used correctly.  You are not using them correctly.
They are only for computed gotos and nothing else.
They are not designed for anything else.  In fact if GCC changes the behavior,
it would be for the worse as then people using them correctly would be
punished.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug middle-end/29305] local label-as-value being placed before function prolog
  2006-10-01  4:33 [Bug c/29305] New: " jeremy at goop dot org
                   ` (4 preceding siblings ...)
  2006-10-01  5:55 ` jeremy at goop dot org
@ 2006-10-01  6:00 ` jeremy at goop dot org
  2006-10-01  6:24 ` pinskia at gcc dot gnu dot org
  2006-10-01  8:47 ` jeremy at goop dot org
  7 siblings, 0 replies; 10+ messages in thread
From: jeremy at goop dot org @ 2006-10-01  6:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jeremy at goop dot org  2006-10-01 05:58 -------
Reopen as enhancement, in the hope gcc implements more useful semantics for
taking the address of a label.


-- 

jeremy at goop dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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


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

* [Bug middle-end/29305] local label-as-value being placed before function prolog
  2006-10-01  4:33 [Bug c/29305] New: " jeremy at goop dot org
                   ` (3 preceding siblings ...)
  2006-10-01  5:45 ` pinskia at gcc dot gnu dot org
@ 2006-10-01  5:55 ` jeremy at goop dot org
  2006-10-01  6:00 ` jeremy at goop dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: jeremy at goop dot org @ 2006-10-01  5:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jeremy at goop dot org  2006-10-01 05:55 -------
Subject: Re:  local label-as-value being placed before
 function prolog

pinskia at gcc dot gnu dot org wrote:
> what do you really want?  Because what you have mentioned so far seems like you
> should be writting a .s file and not something in C.
>   
I'm replacing a bunch of arch-specific assembler with C, because 
generating assembler to emit structure definitions is just painful 
makework.  All I need is a bit of cooperation from gcc to generate a 
label pointing to the right instruction, and it will save me a heap of code.

There is also another set of Linux patches which are trying to use 
labels in a similar way to mark tracepoints in the code, for later 
insertion of instrumentation, which will clearly not be reliable with 
gcc in its current state.

> Read the documentation again.
>   
I have, in detail, and it doesn't really preclude how I want to use 
these labels.  I do not want to jump into the function from outside, or 
use goto on them at all.  But that doesn't mean I don't have a use for them.

> Actually it sounds like you would like to have more information for people
> filing bug reports well this is not the correct way of doing it.  You should
> plan a better way. 
>   
I'm not sure I can parse this.  But I'd like you to consider this as a 
feature request for gcc, because from my perspective gcc doing what I 
want is far better than the alternatives.


-- 


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


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

* [Bug middle-end/29305] local label-as-value being placed before function prolog
  2006-10-01  4:33 [Bug c/29305] New: " jeremy at goop dot org
                   ` (2 preceding siblings ...)
  2006-10-01  5:42 ` jeremy at goop dot org
@ 2006-10-01  5:45 ` pinskia at gcc dot gnu dot org
  2006-10-01  5:55 ` jeremy at goop dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-10-01  5:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2006-10-01 05:45 -------
(In reply to comment #4)
> Well, it isn't failing in any obvious fashion.  It's quietly putting the label
> at the wrong place, without complaint.  
There is no wrong place if you don't use it via a local computed goto as
mention 
in the documetnion.

> The same code later in a function does
> put the labels at the right place, so the failure mode is moderately subtle. 
> If you don't intent to support my use-case, then gcc should warn/error-out
> rather than be quietly wrong.

It is not placing the label in the wrong place as you don't have a computed
goto in the function.

> 
> That said, I don't really understand why this can't be supported.  In what way
> is this "not the correct way to think about what I'm doing"?  How else should I
> achieve what I want?

what do you really want?  Because what you have mentioned so far seems like you
should be writting a .s file and not something in C.

> I should mention that this is Linux kernel code, and there are a number of
> places within the kernel where it would be useful to take the address of a
> particular statement without needing to "goto" to it, but have the code
> generated as if there is a goto (ie, merely taking the address of a label
> should be taken to be equivalent to actually having a goto to that label).

It is wrong to store the label to jump back to that label outside of the
function as mentioned in the documention.

Read the documentation again.

Actually it sounds like you would like to have more information for people
filing bug reports well this is not the correct way of doing it.  You should
plan a better way. 


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug middle-end/29305] local label-as-value being placed before function prolog
  2006-10-01  4:33 [Bug c/29305] New: " jeremy at goop dot org
  2006-10-01  5:29 ` [Bug middle-end/29305] " pinskia at gcc dot gnu dot org
  2006-10-01  5:37 ` jeremy at goop dot org
@ 2006-10-01  5:42 ` jeremy at goop dot org
  2006-10-01  5:45 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: jeremy at goop dot org @ 2006-10-01  5:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jeremy at goop dot org  2006-10-01 05:42 -------
Created an attachment (id=12363)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12363&action=view)
More complete example of what I'm trying to do


-- 


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


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

* [Bug middle-end/29305] local label-as-value being placed before function prolog
  2006-10-01  4:33 [Bug c/29305] New: " jeremy at goop dot org
  2006-10-01  5:29 ` [Bug middle-end/29305] " pinskia at gcc dot gnu dot org
@ 2006-10-01  5:37 ` jeremy at goop dot org
  2006-10-01  5:42 ` jeremy at goop dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: jeremy at goop dot org @ 2006-10-01  5:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jeremy at goop dot org  2006-10-01 05:36 -------
Well, it isn't failing in any obvious fashion.  It's quietly putting the label
at the wrong place, without complaint.  The same code later in a function does
put the labels at the right place, so the failure mode is moderately subtle. 
If you don't intent to support my use-case, then gcc should warn/error-out
rather than be quietly wrong.

That said, I don't really understand why this can't be supported.  In what way
is this "not the correct way to think about what I'm doing"?  How else should I
achieve what I want?

I should mention that this is Linux kernel code, and there are a number of
places within the kernel where it would be useful to take the address of a
particular statement without needing to "goto" to it, but have the code
generated as if there is a goto (ie, merely taking the address of a label
should be taken to be equivalent to actually having a goto to that label).


-- 

jeremy at goop dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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


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

* [Bug middle-end/29305] local label-as-value being placed before function prolog
  2006-10-01  4:33 [Bug c/29305] New: " jeremy at goop dot org
@ 2006-10-01  5:29 ` pinskia at gcc dot gnu dot org
  2006-10-01  5:37 ` jeremy at goop dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-10-01  5:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-10-01 05:29 -------
It is failing right out if you don't have any computed gotos in your function
(or a goto to that label).
You should try doing:
asm volatile("faulted: ud2");
and make faulted a static function but that might not work with unrolling, etc.

Really there is no way for doing what you are asking and really not the correct
way to think about what you are doing.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
          Component|c                           |middle-end
         Resolution|                            |INVALID


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


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

end of thread, other threads:[~2024-03-16 18:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-29305-4@http.gcc.gnu.org/bugzilla/>
2021-01-30 12:18 ` [Bug middle-end/29305] local label-as-value being placed before function prolog stsp at users dot sourceforge.net
2024-03-16 18:09 ` pinskia at gcc dot gnu.org
2006-10-01  4:33 [Bug c/29305] New: " jeremy at goop dot org
2006-10-01  5:29 ` [Bug middle-end/29305] " pinskia at gcc dot gnu dot org
2006-10-01  5:37 ` jeremy at goop dot org
2006-10-01  5:42 ` jeremy at goop dot org
2006-10-01  5:45 ` pinskia at gcc dot gnu dot org
2006-10-01  5:55 ` jeremy at goop dot org
2006-10-01  6:00 ` jeremy at goop dot org
2006-10-01  6:24 ` pinskia at gcc dot gnu dot org
2006-10-01  8:47 ` jeremy at goop dot 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).