public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/33932]  New: miscalculation of asm labels with -g3
@ 2007-10-28 18:52 stsp at users dot sourceforge dot net
  2007-10-28 18:56 ` [Bug inline-asm/33932] " stsp at users dot sourceforge dot net
                   ` (22 more replies)
  0 siblings, 23 replies; 24+ messages in thread
From: stsp at users dot sourceforge dot net @ 2007-10-28 18:52 UTC (permalink / raw)
  To: gcc-bugs

The following test program will
print "OK" if compiled without -g3
(-g1, -g2 are fine), and Segfaults
with -g3.

---
#include <stdio.h>

asm (
"__tst:\n"
"movl $1, %eax\n"
"ret\n");
int tst(void) asm ("__tst");

int main()
{
    if (tst() == 1)
        printf("OK\n");
    else
        printf("Segmentation fault\n");
    return 0;
}
---

With -g3, tst() will call to the wrong
address.

gcc version 4.1.2 20070925 (Red Hat 4.1.2-27)


-- 
           Summary: miscalculation of asm labels with -g3
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: stsp at users dot sourceforge dot net
  GCC host triplet: x86_64, i386
GCC target triplet: x86_64, i386


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


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
@ 2007-10-28 18:56 ` stsp at users dot sourceforge dot net
  2007-10-28 18:59 ` pinskia at gcc dot gnu dot org
                   ` (21 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: stsp at users dot sourceforge dot net @ 2007-10-28 18:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from stsp at users dot sourceforge dot net  2007-10-28 18:55 -------
Created an attachment (id=14428)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14428&action=view)
the test case


-- 


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


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
  2007-10-28 18:56 ` [Bug inline-asm/33932] " stsp at users dot sourceforge dot net
@ 2007-10-28 18:59 ` pinskia at gcc dot gnu dot org
  2007-10-28 19:25 ` stsp at users dot sourceforge dot net
                   ` (20 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-10-28 18:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2007-10-28 18:59 -------
Your inline-asm is incorrect as you did not place the symbol in any section so
it just defaults to what ever section is currently there (which in the -g3 case
is the debugging section).

This corrects the issue:
asm (
".text\n"
"__tst:\n"
"movl $1, %eax\n"
"ret\n"
".previous\n");

Or something like that.


-- 

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=33932


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
  2007-10-28 18:56 ` [Bug inline-asm/33932] " stsp at users dot sourceforge dot net
  2007-10-28 18:59 ` pinskia at gcc dot gnu dot org
@ 2007-10-28 19:25 ` stsp at users dot sourceforge dot net
  2007-10-29 17:50 ` stsp at users dot sourceforge dot net
                   ` (19 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: stsp at users dot sourceforge dot net @ 2007-10-28 19:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from stsp at users dot sourceforge dot net  2007-10-28 19:25 -------
Ohh... thanks for taking a look.
But is it documented anywhere that the
inline asm _must_ specify the section?
I thought the asm code, as well as the
C code, will utilize the .text, unless
the opposite is specified.
And now, since it is not the case only
with -g3, maybe it is a bug after all?
Is it really wise to have the default
section for asm to depend on -g switch?
dosemu seems to be miscompiled because
of this.
Also, even if the asm code is put into
another section, why it cannot be called
from there? (unless the section is NX,
of course)


-- 


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


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
                   ` (2 preceding siblings ...)
  2007-10-28 19:25 ` stsp at users dot sourceforge dot net
@ 2007-10-29 17:50 ` stsp at users dot sourceforge dot net
  2008-01-11 21:17 ` stsp at users dot sourceforge dot net
                   ` (18 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: stsp at users dot sourceforge dot net @ 2007-10-29 17:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from stsp at users dot sourceforge dot net  2007-10-29 17:49 -------
> Also, even if the asm code is put into
> another section, why it cannot be called
> from there?
This section does not seem to have "a",
so that's why...
But its still nasty that the current
section depends on the -g option and
I fail to see anything in the docs
that would make this code invalid.


-- 


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


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
                   ` (3 preceding siblings ...)
  2007-10-29 17:50 ` stsp at users dot sourceforge dot net
@ 2008-01-11 21:17 ` stsp at users dot sourceforge dot net
  2008-01-11 21:43 ` mmitchel at gcc dot gnu dot org
                   ` (17 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: stsp at users dot sourceforge dot net @ 2008-01-11 21:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from stsp at users dot sourceforge dot net  2008-01-11 20:14 -------
Actually I don't believe it is not a bug.
The properly functional code cannot be
miscompiled that easily only because of
the different -g option.
Adding Mark to CC for the final judgement
on this. :)


-- 

stsp at users dot sourceforge dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stsp at users dot
                   |                            |sourceforge dot net,
                   |                            |mmitchel at gcc dot gnu dot
                   |                            |org
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
                   ` (4 preceding siblings ...)
  2008-01-11 21:17 ` stsp at users dot sourceforge dot net
@ 2008-01-11 21:43 ` mmitchel at gcc dot gnu dot org
  2008-01-11 23:41 ` stsp at users dot sourceforge dot net
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2008-01-11 21:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from mmitchel at gcc dot gnu dot org  2008-01-11 21:23 -------
I do think this is a bug.  It's certainly not going to meet user expectations. 

I think this is another case of a GCC extension that could have been
better-designed.  If we were starting from scratch, I think saying that an asm
defaults to the text section, unless it has an explicit section attribute,
would be a good thing.  But, I don't think we can change this now; there is
definitely code out there that depends on switching sections and then emitting
an asm.

But, we could make sure that we always pop back from the debug section to
whatever the preceding section was after emitting debug information.  That
seems reasonable to me, as I don't think people are trying to implicitly put
stuff into the debug section.  (If they want to do that, they explicitly use a
".section" directive.)  That would fix this case and probably avoid the problem
in general.

We could also add the ability to use __attribute__((section)) with an asm, like
so:

  __attribute__((section (".text"))) asm ("...");

with the semantics that we would enter that section, emit the asm, and then pop
back to whatever section we had before.  That would give users a natural way to
specify what section an asm goes into, without having to put ".section"
directives in the asm itself.


-- 


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


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
                   ` (5 preceding siblings ...)
  2008-01-11 21:43 ` mmitchel at gcc dot gnu dot org
@ 2008-01-11 23:41 ` stsp at users dot sourceforge dot net
  2008-12-28  2:37 ` pinskia at gcc dot gnu dot org
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: stsp at users dot sourceforge dot net @ 2008-01-11 23:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from stsp at users dot sourceforge dot net  2008-01-11 22:02 -------
Thank you for the prompt reply!

I also think simply changing to the previous
section is the good fix because the main problem,
as I see it, is that the -g3 currently has the
different behaveour than the other -gX options.
The fact that asm() doesn't automatically
change to .text is, as you say, not really a bug.
But the erratic behaveour of -g3 certainly is.
I guess the problem is that currently it is not
officially documented what section is used by default,
so the one may say any random section is OK. But IMHO
it would be much better to have a particular section
be a default, and have it documented.


-- 


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


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
                   ` (6 preceding siblings ...)
  2008-01-11 23:41 ` stsp at users dot sourceforge dot net
@ 2008-12-28  2:37 ` pinskia at gcc dot gnu dot org
  2008-12-28  9:41 ` stsp at users dot sourceforge dot net
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-28  2:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gcc dot gnu dot org  2008-12-28 02:33 -------


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


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
                   ` (7 preceding siblings ...)
  2008-12-28  2:37 ` pinskia at gcc dot gnu dot org
@ 2008-12-28  9:41 ` stsp at users dot sourceforge dot net
  2008-12-28 12:21 ` steven at gcc dot gnu dot org
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: stsp at users dot sourceforge dot net @ 2008-12-28  9:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from stsp at users dot sourceforge dot net  2008-12-28 09:40 -------
OK, Andrew, why do you do this?
Mark have confirmed the existance of
the bug here, yet you resolve it as
a duplicate of an INVALID bug.
Why not to fix the -g3 instead of
always closing this?
Anyway, this is the last time I am
reopening, so you can do whatever you
want.


-- 

stsp at users dot sourceforge dot net changed:

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


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


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
                   ` (8 preceding siblings ...)
  2008-12-28  9:41 ` stsp at users dot sourceforge dot net
@ 2008-12-28 12:21 ` steven at gcc dot gnu dot org
  2008-12-28 12:35 ` stsp at users dot sourceforge dot net
                   ` (12 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: steven at gcc dot gnu dot org @ 2008-12-28 12:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from steven at gcc dot gnu dot org  2008-12-28 12:20 -------
Re. comment #9
This is imho a bug, but I'd probably just fix it with a small documentation
update.  Mark tends to describe the situation as it should be, but I wouldn't
want you to expect Mark, nor anyone else, to actually implement that.


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   GCC host triplet|x86_64, i386                |
 GCC target triplet|x86_64, i386                |
   Last reconfirmed|0000-00-00 00:00:00         |2008-12-28 12:20:14
               date|                            |


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


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
                   ` (9 preceding siblings ...)
  2008-12-28 12:21 ` steven at gcc dot gnu dot org
@ 2008-12-28 12:35 ` stsp at users dot sourceforge dot net
  2008-12-28 12:53 ` steven at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: stsp at users dot sourceforge dot net @ 2008-12-28 12:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from stsp at users dot sourceforge dot net  2008-12-28 12:33 -------
> but I wouldn't
> want you to expect Mark, nor anyone else, to actually implement that.
Is this because it would be too
much work to implement, or is it
really undesireable?
Just wondering.


-- 


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


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
                   ` (10 preceding siblings ...)
  2008-12-28 12:35 ` stsp at users dot sourceforge dot net
@ 2008-12-28 12:53 ` steven at gcc dot gnu dot org
  2008-12-28 13:04 ` stsp at users dot sourceforge dot net
                   ` (10 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: steven at gcc dot gnu dot org @ 2008-12-28 12:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from steven at gcc dot gnu dot org  2008-12-28 12:51 -------
Undesirable. As Mark already pointed out, we'd probably end up breaking legacy
code.


-- 


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


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
                   ` (11 preceding siblings ...)
  2008-12-28 12:53 ` steven at gcc dot gnu dot org
@ 2008-12-28 13:04 ` stsp at users dot sourceforge dot net
  2008-12-28 13:05 ` stsp at users dot sourceforge dot net
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: stsp at users dot sourceforge dot net @ 2008-12-28 13:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from stsp at users dot sourceforge dot net  2008-12-28 13:03 -------
The problem is that -g and -g3 do
behave differently. You can't break any
code by making -g3 to behave similar to
-g, or can you?
Its exactly the opposite. -g3 breaks
the code that otherwise works fine (dosemu).
What breakage do you foresee if -g3
will just behave similar to -g? What
breakage is that?


-- 


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


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
                   ` (12 preceding siblings ...)
  2008-12-28 13:04 ` stsp at users dot sourceforge dot net
@ 2008-12-28 13:05 ` stsp at users dot sourceforge dot net
  2008-12-28 13:16 ` steven at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: stsp at users dot sourceforge dot net @ 2008-12-28 13:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from stsp at users dot sourceforge dot net  2008-12-28 13:04 -------
And what Mark says, is:

---
But, we could make sure that we always pop back from the debug section to
whatever the preceding section was after emitting debug information.  That
seems reasonable to me, as I don't think people are trying to implicitly put
stuff into the debug section.  (If they want to do that, they explicitly use a
".section" directive.)  That would fix this case and probably avoid the problem
in general.
---


-- 


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


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
                   ` (13 preceding siblings ...)
  2008-12-28 13:05 ` stsp at users dot sourceforge dot net
@ 2008-12-28 13:16 ` steven at gcc dot gnu dot org
  2008-12-28 13:24 ` steven at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: steven at gcc dot gnu dot org @ 2008-12-28 13:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from steven at gcc dot gnu dot org  2008-12-28 13:15 -------
Which part of "...as I don't think people are trying to..." gives you the
certainty that really "people don't"?

Anyway, as far as I'm concerned, this is end of discussion.  There is nothing
stopping you from working on this if you want to fix this through some other
means than a documentation change.  Patches welcome, as we say.


-- 


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


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
                   ` (14 preceding siblings ...)
  2008-12-28 13:16 ` steven at gcc dot gnu dot org
@ 2008-12-28 13:24 ` steven at gcc dot gnu dot org
  2008-12-28 13:55 ` stsp at users dot sourceforge dot net
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: steven at gcc dot gnu dot org @ 2008-12-28 13:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from steven at gcc dot gnu dot org  2008-12-28 13:23 -------
In fact, Mark's suggestion wouldn't actually work in all cases.  With
-ffunction-sections, your function definition may end up in a section that will
be eliminated by the linker.  And if the preceding section was a non-.text
section, so there is no guarantee that your asm ends up in an executable
section.

The real bug here, IMHO, is that it works at all for -g1 and -g2.  The compiler
should probably warn about top-level asm blocks without explicit section
switches.  But that's probably hard to implement (involves scanning the asm
text for section switches), so, again, I doubt anyone would want to implement
this.


-- 


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


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
                   ` (15 preceding siblings ...)
  2008-12-28 13:24 ` steven at gcc dot gnu dot org
@ 2008-12-28 13:55 ` stsp at users dot sourceforge dot net
  2008-12-28 14:04 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: stsp at users dot sourceforge dot net @ 2008-12-28 13:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from stsp at users dot sourceforge dot net  2008-12-28 13:54 -------
> Which part of "...as I don't think people are trying to..." gives you the
> certainty that really "people don't"?
What gives me that certainty is the
fact that this happens only with -g3.
Do you think someone depended himself
on -g3 and is not compiling his programs
with -g[012], so that this gcc behaveour
is worth keeping?

> The real bug here, IMHO, is that it works at all for -g1 and -g2.
> The compiler should probably warn about top-level asm blocks without
> explicit section switches.
OK, that explains a bit, thanks!
It also works without -g at all,
so some people depended on that
for some reasons (dosemu breaks with -g3),
but I understand such a warning is
not possible to implement.


-- 


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


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
                   ` (16 preceding siblings ...)
  2008-12-28 13:55 ` stsp at users dot sourceforge dot net
@ 2008-12-28 14:04 ` pinskia at gcc dot gnu dot org
  2008-12-28 18:43 ` mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-28 14:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from pinskia at gcc dot gnu dot org  2008-12-28 14:03 -------
> Do you think someone depended himself on -g3 and is not compiling his programs
> with -g[012], so that this gcc behavior is worth keeping?


It just happens to work at -O0, does not mean it is a bug in GCC, likewise with
-g1 :).


-- 


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


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
                   ` (17 preceding siblings ...)
  2008-12-28 14:04 ` pinskia at gcc dot gnu dot org
@ 2008-12-28 18:43 ` mmitchel at gcc dot gnu dot org
  2008-12-29 12:31 ` bonzini at gnu dot org
                   ` (3 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2008-12-28 18:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #19 from mmitchel at gcc dot gnu dot org  2008-12-28 18:41 -------
I agree with Steven that there are some cases (like -ffunction-sections) where
even popping back from the debug section after generating it doesn't work. 
However, I'm not sure that's a reason not to do it -- reducing the chances for
unexpected behavior is still progress.  This is a real "gotcha".

At the least, we should document the problem shown by this bug before closing
it.  There should be a warning to users that they must explicitly indicate the
section in which they want to place their "asm", by using an appropriate
".section" directive (or equivalent, depending on their choice of assembler and
operating system).  We should also explain whether this is required for local
asms, or only for those occurring at global scope.  That would at least clarify
our intent.


-- 


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


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
                   ` (18 preceding siblings ...)
  2008-12-28 18:43 ` mmitchel at gcc dot gnu dot org
@ 2008-12-29 12:31 ` bonzini at gnu dot org
  2008-12-29 23:07 ` stsp at users dot sourceforge dot net
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: bonzini at gnu dot org @ 2008-12-29 12:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #20 from bonzini at gnu dot org  2008-12-29 12:26 -------
*** Bug 26908 has been marked as a duplicate of this bug. ***


-- 

bonzini at gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ed at catmur dot co dot uk


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


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
                   ` (19 preceding siblings ...)
  2008-12-29 12:31 ` bonzini at gnu dot org
@ 2008-12-29 23:07 ` stsp at users dot sourceforge dot net
  2008-12-29 23:50 ` mark at codesourcery dot com
  2009-06-10 16:33 ` pinskia at gcc dot gnu dot org
  22 siblings, 0 replies; 24+ messages in thread
From: stsp at users dot sourceforge dot net @ 2008-12-29 23:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #21 from stsp at users dot sourceforge dot net  2008-12-29 22:16 -------
> I agree with Steven that there are some cases (like -ffunction-sections) where
> even popping back from the debug section after generating it doesn't work. 
Can this possibly be solved by emitting
a warning if the asm in global scope is
used with -ffunction-sections? I think
the asm in global scope and the -ffunction-sections
is a bad combination, so maybe a warning
can help?


-- 


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


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
                   ` (20 preceding siblings ...)
  2008-12-29 23:07 ` stsp at users dot sourceforge dot net
@ 2008-12-29 23:50 ` mark at codesourcery dot com
  2009-06-10 16:33 ` pinskia at gcc dot gnu dot org
  22 siblings, 0 replies; 24+ messages in thread
From: mark at codesourcery dot com @ 2008-12-29 23:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #22 from mark at codesourcery dot com  2008-12-29 23:48 -------
Subject: Re:  miscalculation of asm labels with -g3

stsp at users dot sourceforge dot net wrote:

> Can this possibly be solved by emitting
> a warning if the asm in global scope is
> used with -ffunction-sections?

I think the generalization of Steven's point is that we can't really
know what section the user's assembly code should go in: text, data, or
something else, and therefore we'd better depend on the user to tell us.
 I still think it would be an OK idea to try to reduce the chances of
something bad happening -- and the inconsistency between -g levels -- by
popping back from the debug section, but the fundamental point is that
if the user wants full robustness they need to say what section in which
to put the assembly code.


-- 


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


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

* [Bug inline-asm/33932] miscalculation of asm labels with -g3
  2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
                   ` (21 preceding siblings ...)
  2008-12-29 23:50 ` mark at codesourcery dot com
@ 2009-06-10 16:33 ` pinskia at gcc dot gnu dot org
  22 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-06-10 16:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #23 from pinskia at gcc dot gnu dot org  2009-06-10 16:32 -------
*** Bug 40403 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rmansfield at qnx dot com


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


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

end of thread, other threads:[~2009-06-10 16:33 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-28 18:52 [Bug inline-asm/33932] New: miscalculation of asm labels with -g3 stsp at users dot sourceforge dot net
2007-10-28 18:56 ` [Bug inline-asm/33932] " stsp at users dot sourceforge dot net
2007-10-28 18:59 ` pinskia at gcc dot gnu dot org
2007-10-28 19:25 ` stsp at users dot sourceforge dot net
2007-10-29 17:50 ` stsp at users dot sourceforge dot net
2008-01-11 21:17 ` stsp at users dot sourceforge dot net
2008-01-11 21:43 ` mmitchel at gcc dot gnu dot org
2008-01-11 23:41 ` stsp at users dot sourceforge dot net
2008-12-28  2:37 ` pinskia at gcc dot gnu dot org
2008-12-28  9:41 ` stsp at users dot sourceforge dot net
2008-12-28 12:21 ` steven at gcc dot gnu dot org
2008-12-28 12:35 ` stsp at users dot sourceforge dot net
2008-12-28 12:53 ` steven at gcc dot gnu dot org
2008-12-28 13:04 ` stsp at users dot sourceforge dot net
2008-12-28 13:05 ` stsp at users dot sourceforge dot net
2008-12-28 13:16 ` steven at gcc dot gnu dot org
2008-12-28 13:24 ` steven at gcc dot gnu dot org
2008-12-28 13:55 ` stsp at users dot sourceforge dot net
2008-12-28 14:04 ` pinskia at gcc dot gnu dot org
2008-12-28 18:43 ` mmitchel at gcc dot gnu dot org
2008-12-29 12:31 ` bonzini at gnu dot org
2008-12-29 23:07 ` stsp at users dot sourceforge dot net
2008-12-29 23:50 ` mark at codesourcery dot com
2009-06-10 16:33 ` pinskia at gcc dot gnu 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).