linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GCC] gcc vs. indentation
@ 2003-06-30  5:20 Samium Gromoff
  2003-06-30  7:04 ` Hugh Dickins
  2003-07-01 13:12 ` Horst von Brand
  0 siblings, 2 replies; 4+ messages in thread
From: Samium Gromoff @ 2003-06-30  5:20 UTC (permalink / raw)
  To: linux-kernel, gcc-bugs

[-- Attachment #1: Type: text/plain, Size: 3381 bytes --]

	The story begun when i`ve started to make indentation fixes in the DAC960 driver.
 And in order to ensure i didn`t broke anything i was checking a diff between the
 resulting object files.

	Surprisingly enough i`ve realised soon that indeed some indentation changes
 give gcc a reason to produce different code.

	One of the cases is below, all three of them are in the attached .tar.gz file.
	The code in question is the 2.5.72-bk1 kernel, however there was no changes
 in the related code for some time, so plain .72 should be safe.

	The examples are in the form of pairs of a C diff, and a "objdump -d" output diff.

The C diff:
diff -X scripts/Xrule -urN 25/drivers/block/DAC960.c 25dac/drivers/block/DAC960.c
--- 25/drivers/block/DAC960.c   2003-06-17 01:09:50.000000000 +0400
+++ 25dac/drivers/block/DAC960.c        2003-06-29 22:11:01.000000000 +0400
@@ -272,8 +272,7 @@
   dma_addr_t RequestSenseDMA;
   struct pci_pool *RequestSensePool = NULL;

-  if (Controller->FirmwareType == DAC960_V1_Controller)
-    {
+  if (Controller->FirmwareType == DAC960_V1_Controller) {
       CommandAllocationLength = offsetof(DAC960_Command_T, V1.EndMarker);
       CommandAllocationGroupSize = DAC960_V1_CommandAllocationGroupSize;
       ScatterGatherPool = pci_pool_create("DAC960_V1_ScatterGather",

--- ./origDAC960.o.d    2003-06-29 21:02:55.000000000 +0400
+++ ./newDAC960.o.d     2003-06-29 22:13:46.000000000 +0400
@@ -1,5 +1,5 @@

-origDAC960.o:     file format elf32-i386
+./newDAC960.o:     file format elf32-i386

 Disassembly of section .text:

@@ -5837,7 +5837,7 @@
     52a8:      84 c0                   test   %al,%al
     52aa:      75 14                   jne    52c0 <DAC960_V1_ProcessCompletedCommand+0x80>
     52ac:      0f 0b                   ud2a
-    52ae:      7d 0d                   jge    52bd <DAC960_V1_ProcessCompletedCommand+0x7d>
+    52ae:      7c 0d                   jl     52bd <DAC960_V1_ProcessCompletedCommand+0x7d>
     52b0:      27                      daa
     52b1:      00 00                   add    %al,(%eax)
     52b3:      00 8d b6 00 00 00       add    %cl,0xb6(%ebp)
@@ -5951,7 +5951,7 @@
     5421:      84 c0                   test   %al,%al
     5423:      0f 85 97 fe ff ff       jne    52c0 <DAC960_V1_ProcessCompletedCommand+0x80>
     5429:      0f 0b                   ud2a
-    542b:      8f 0d 27 00 00 00       popl   0x27
+    542b:      8e 0d 27 00 00 00       movl   0x27,%cs
     5431:      e9 8a fe ff ff          jmp    52c0 <DAC960_V1_ProcessCompletedCommand+0x80>
     5436:      89 1c 24                mov    %ebx,(%esp,1)
     5439:      e8 fc ff ff ff          call   543a <DAC960_V1_ProcessCompletedCommand+0x1fa>
@@ -7414,7 +7414,7 @@
     6ba2:      84 c0                   test   %al,%al
     6ba4:      75 0a                   jne    6bb0 <DAC960_V2_ProcessCompletedCommand+0xa0>
     6ba6:      0f 0b                   ud2a
-    6ba8:      bc 11 27 00 00          mov    $0x2711,%esp
+    6ba8:      bb 11 27 00 00          mov    $0x2711,%ebx
     6bad:      00 89 f6 83 bc 24       add    %cl,0x24bc83f6(%ecx)
     6bb3:      84 00                   test   %al,(%eax)
     6bb5:      00 00                   add    %al,(%eax)


Thats it.
The point is i thought and hoped that gcc abstract syntax tree constructor is
indentation invariant, and that is seemingly not true.

regards, Samium Gromoff

[-- Attachment #2: gcc-hrmph.tar.gz --]
[-- Type: application/octet-stream, Size: 2070 bytes --]

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

* Re: [GCC] gcc vs. indentation
  2003-06-30  7:04 ` Hugh Dickins
@ 2003-06-30  6:13   ` Samium Gromoff
  0 siblings, 0 replies; 4+ messages in thread
From: Samium Gromoff @ 2003-06-30  6:13 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: linux-kernel, gcc-bugs

On Mon, 30 Jun 2003 08:04:03 +0100 (BST)
Hugh Dickins <hugh@veritas.com> wrote:

> On Mon, 30 Jun 2003, Samium Gromoff wrote:
> > 
> > -  if (Controller->FirmwareType == DAC960_V1_Controller)
> > -    {
> > +  if (Controller->FirmwareType == DAC960_V1_Controller) {
> 
> > -origDAC960.o:     file format elf32-i386
> > +./newDAC960.o:     file format elf32-i386
> > 
> >  Disassembly of section .text:
> > 
> > @@ -5837,7 +5837,7 @@
> >      52a8:      84 c0                   test   %al,%al
> >      52aa:      75 14                   jne    52c0 <DAC960_V1_ProcessCompletedCommand+0x80>
> >      52ac:      0f 0b                   ud2a
> > -    52ae:      7d 0d                   jge    52bd <DAC960_V1_ProcessCompletedCommand+0x7d>
> > +    52ae:      7c 0d                   jl     52bd <DAC960_V1_ProcessCompletedCommand+0x7d>
> >      52b0:      27                      daa
> >      52b1:      00 00                   add    %al,(%eax)
> >      52b3:      00 8d b6 00 00 00       add    %cl,0xb6(%ebp)
> > @@ -5951,7 +5951,7 @@
> >      5421:      84 c0                   test   %al,%al
> >      5423:      0f 85 97 fe ff ff       jne    52c0 <DAC960_V1_ProcessCompletedCommand+0x80>
> >      5429:      0f 0b                   ud2a
> > -    542b:      8f 0d 27 00 00 00       popl   0x27
> > +    542b:      8e 0d 27 00 00 00       movl   0x27,%cs
> >      5431:      e9 8a fe ff ff          jmp    52c0 <DAC960_V1_ProcessCompletedCommand+0x80>
> >      5436:      89 1c 24                mov    %ebx,(%esp,1)
> >      5439:      e8 fc ff ff ff          call   543a <DAC960_V1_ProcessCompletedCommand+0x1fa>
> > @@ -7414,7 +7414,7 @@
> >      6ba2:      84 c0                   test   %al,%al
> >      6ba4:      75 0a                   jne    6bb0 <DAC960_V2_ProcessCompletedCommand+0xa0>
> >      6ba6:      0f 0b                   ud2a
> > -    6ba8:      bc 11 27 00 00          mov    $0x2711,%esp
> > +    6ba8:      bb 11 27 00 00          mov    $0x2711,%ebx
> >      6bad:      00 89 f6 83 bc 24       add    %cl,0x24bc83f6(%ecx)
> >      6bb3:      84 00                   test   %al,(%eax)
> >      6bb5:      00 00                   add    %al,(%eax)
> > 
> > Thats it.
> > The point is i thought and hoped that gcc abstract syntax tree constructor is
> > indentation invariant, and that is seemingly not true.
> 
> It's okay, no need to worry.  See the "ud2a"s just above the differences?
> Those are BUG()s, and they're going to be followed by a short __LINE__
> then __FILE__ pointer.  Your indentation change removed one line, so the
> BUG()'s __LINE__ numbers have gone down one.  (And it takes a while for
> the disassembly to get back to sanity with the instructions thereafter.)

	Uhhuh, i see now... those by-one differences looked strange for me... :-)

> 
> Hugh
> 
> 

-- 
regards, Samium Gromoff

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

* Re: [GCC] gcc vs. indentation
  2003-06-30  5:20 [GCC] gcc vs. indentation Samium Gromoff
@ 2003-06-30  7:04 ` Hugh Dickins
  2003-06-30  6:13   ` Samium Gromoff
  2003-07-01 13:12 ` Horst von Brand
  1 sibling, 1 reply; 4+ messages in thread
From: Hugh Dickins @ 2003-06-30  7:04 UTC (permalink / raw)
  To: Samium Gromoff; +Cc: linux-kernel, gcc-bugs

On Mon, 30 Jun 2003, Samium Gromoff wrote:
> 
> -  if (Controller->FirmwareType == DAC960_V1_Controller)
> -    {
> +  if (Controller->FirmwareType == DAC960_V1_Controller) {

> -origDAC960.o:     file format elf32-i386
> +./newDAC960.o:     file format elf32-i386
> 
>  Disassembly of section .text:
> 
> @@ -5837,7 +5837,7 @@
>      52a8:      84 c0                   test   %al,%al
>      52aa:      75 14                   jne    52c0 <DAC960_V1_ProcessCompletedCommand+0x80>
>      52ac:      0f 0b                   ud2a
> -    52ae:      7d 0d                   jge    52bd <DAC960_V1_ProcessCompletedCommand+0x7d>
> +    52ae:      7c 0d                   jl     52bd <DAC960_V1_ProcessCompletedCommand+0x7d>
>      52b0:      27                      daa
>      52b1:      00 00                   add    %al,(%eax)
>      52b3:      00 8d b6 00 00 00       add    %cl,0xb6(%ebp)
> @@ -5951,7 +5951,7 @@
>      5421:      84 c0                   test   %al,%al
>      5423:      0f 85 97 fe ff ff       jne    52c0 <DAC960_V1_ProcessCompletedCommand+0x80>
>      5429:      0f 0b                   ud2a
> -    542b:      8f 0d 27 00 00 00       popl   0x27
> +    542b:      8e 0d 27 00 00 00       movl   0x27,%cs
>      5431:      e9 8a fe ff ff          jmp    52c0 <DAC960_V1_ProcessCompletedCommand+0x80>
>      5436:      89 1c 24                mov    %ebx,(%esp,1)
>      5439:      e8 fc ff ff ff          call   543a <DAC960_V1_ProcessCompletedCommand+0x1fa>
> @@ -7414,7 +7414,7 @@
>      6ba2:      84 c0                   test   %al,%al
>      6ba4:      75 0a                   jne    6bb0 <DAC960_V2_ProcessCompletedCommand+0xa0>
>      6ba6:      0f 0b                   ud2a
> -    6ba8:      bc 11 27 00 00          mov    $0x2711,%esp
> +    6ba8:      bb 11 27 00 00          mov    $0x2711,%ebx
>      6bad:      00 89 f6 83 bc 24       add    %cl,0x24bc83f6(%ecx)
>      6bb3:      84 00                   test   %al,(%eax)
>      6bb5:      00 00                   add    %al,(%eax)
> 
> Thats it.
> The point is i thought and hoped that gcc abstract syntax tree constructor is
> indentation invariant, and that is seemingly not true.

It's okay, no need to worry.  See the "ud2a"s just above the differences?
Those are BUG()s, and they're going to be followed by a short __LINE__
then __FILE__ pointer.  Your indentation change removed one line, so the
BUG()'s __LINE__ numbers have gone down one.  (And it takes a while for
the disassembly to get back to sanity with the instructions thereafter.)

Hugh


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

* Re: [GCC] gcc vs. indentation
  2003-06-30  5:20 [GCC] gcc vs. indentation Samium Gromoff
  2003-06-30  7:04 ` Hugh Dickins
@ 2003-07-01 13:12 ` Horst von Brand
  1 sibling, 0 replies; 4+ messages in thread
From: Horst von Brand @ 2003-07-01 13:12 UTC (permalink / raw)
  To: Samium Gromoff; +Cc: linux-kernel, gcc-bugs

Samium Gromoff <deepfire@ibe.miee.ru> said:

[...]

> 	Surprisingly enough i`ve realised soon that indeed some indentation changes
>  give gcc a reason to produce different code.

[...]

> --- ./origDAC960.o.d    2003-06-29 21:02:55.000000000 +0400
> +++ ./newDAC960.o.d     2003-06-29 22:13:46.000000000 +0400
> -    52ae:      7d 0d                   jge    52bd <DAC960_V1_ProcessCompletedCommand+0x7d>
> +    52ae:      7c 0d                   jl     52bd <DAC960_V1_ProcessCompletedCommand+0x7d>

[...]

> -    542b:      8f 0d 27 00 00 00       popl   0x27
> +    542b:      8e 0d 27 00 00 00       movl   0x27,%cs

[...]

> -    6ba8:      bc 11 27 00 00          mov    $0x2711,%esp
> +    6ba8:      bb 11 27 00 00          mov    $0x2711,%ebx

This looks like 1-bit errors to my eye...
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513

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

end of thread, other threads:[~2003-07-01 12:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-30  5:20 [GCC] gcc vs. indentation Samium Gromoff
2003-06-30  7:04 ` Hugh Dickins
2003-06-30  6:13   ` Samium Gromoff
2003-07-01 13:12 ` Horst von Brand

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 NNTP newsgroup(s).