joeware - never stop exploring... :)

Information about joeware mixed with wild and crazy opinions...

I am the bug magnet…

by @ 5:43 pm on 11/29/2008. Filed under tech

As you all know, I have been working away on AdFind lately. I added the ability to decode msPKIRoamingTimeStamp to its two components (create and update time). I wanted to test it and because I don’t have that attrib set on my test environments I needed to compile AdFind in a non-debug mode… And my excitement commenced…

Right off I knew something was wrong, the compiler normally spits AdFind.exe out in about 15-30 seconds or so, after 2 minutes it was still chewing on it… Uh oh. Finally boom, 2 errors. The linker blew up with some error (IMP327 Access Violation) I can’t find a solution for for my case, it seems it usually is a problem with large projects but in Debug mode, my problem was in Release mode and it works great in debug mode….

So I started thinking, well debug versus release is a compiler thing so I looked at the OBJ (object file to you non-devs) file and saw that it was about 6 times larger than it normally is… That could definitely be a cause for the linker to get antsy. It shouldn’t blow up like that but I am more concerned about the compiler issue than the linker issue at the moment as I don’t want an OBJ that is normally 2MB or smaller in a debug compile to be 12MB in a release compile…

So I jump out of the IDE and start playing with the command line compiler BCC32 and eventually realize that the problem is related to inline function expansion. This is something you do to increase speed in your apps, but it causes them to get bigger for all but the most trivial of applications. Now this is something I already knew about because Borland started automatically selecting inline function expansion as the default in BDS 2006 and I had to learn to turn it off on each project or have horribly bloated executables. So I had ALREADY turned it off in the IDE…

I then look closer at the message output in CodeGear C++ Builder 2009 and see that the IDE was specifying the switches “-vi-” and “-v-“. These should mean

-vi-  :  Disable inline function expansion (opposite of -vi  : this is the default setting if you specify nothing)

-v-   : Disable debug (opposite of -v) The default setting if you don’t specify anything should be -v- (i.e. don’t be in debug)

 

So that looked right but after extensive testing I realized that the BCC32 compiler has a bug in it. If you specify “-vi-” it will happily disable the inline function expansion, but if you specify “-vi- -v-” it won’t… Theoretically “-vi-” and “-vi- -v-” should be functionally the same, but it isn’t being treated that way with my compiler.

 

The upshot of all of this is that I have to compile and link by hand at the command line instead of using the nice IDE that I paid so much money for whenever I want to produce a release copy of AdFind right now which annoys the heck out of me.

So I found 3 bugs…

1. “-vi- -v-” should be functionally identical with “-vi-“, they aren’t.

2. The IDE uses “-vi- -v-” instead of “-vi-“

3. The linker blows up because the OBJ produced by compiling with “-vi- -v-” is wrong.

 

After I finally got it compiled and took it to a network that I thought had the msPKIRoamingTimeStamp  attribute set I found out it actually didn’t so I can’t even run the test I wanted to run!!!

 

    joe

 

More Detail:

I logged this all with Code Gear under Code Gear Quality Central Report 69444

Here are the details in the report (doing this so it can be found by anyone searching for any of these terms on the web)

Running on Windows Vista 32 Bit SP1

There appears to be three problems.

1. BCC32 does something different when using “-vi- -v-” than it does if just specifying “-vi-” w/o “-v-“.

When specifying “-vi- -v-” the compile of my project (sorry I cannot provide the project) is extremely slow taking minutes to complete and when it finally completes the OBJ size is 12,437,373 bytes. When I specify “-vi-” without the “-v-” the project compiles within seconds and has an OBJ size of 1,542,100 bytes.  If I specify “-vi- -v” the project compiles within seconds and has an OBJ size of 2,890,523.

If I add the -B switch to compile to ASM, I get sizes of

“-vi-”            : 10,271,585

“-vi- -v”        : 15,991,499

“-vi -v-”        : 88,866,898

Obviously “-v-” is doing something different from not specifying it at all which is unexpected to me from what I see in the usage.

2. In the IDE when I specify release with inline functions not expanded it specifies a command line of “-vi- -v-” instead of “-vi-“, with the above information you can see how that impacts me. I do not see how I can modify that behavior.

3. When “-vi- -v-” is used and the OBJ is 12MB, the linker blows up with an access violation and the following:

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: BSS                 : 0x00000000 / 0x00400000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: CODE                : 0x0000033b / 0x00400000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: DATA                : 0x000000b5 / 0x00400000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: DEBSYM              : 0x0000000e / 0x00400000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: Extdef flags        : 0x00000021 / 0x00004000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: Extdefs             : 0x00000084 / 0x00004000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: Import symbols      : 0x0000030c / 0x00100000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: OBJ symbols         : 0x00000b94 / 0x00100000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: Public GSX          : 0x00000078 / 0x000c0000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: Publics             : 0x00000438 / 0x000c0000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: SegRelocs           : 0x00000820 / 0x00400000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: StringBlock         : 0x00000030 / 0x00400000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: UNKNOWN             : 0x00000006 / 0x00400000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: Virdefs             : 0x00000060 / 0x00020000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: BSS                 : 0x00000000 / 0x00400000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: CODE                : 0x003e4089 / 0x00400000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: DATA                : 0x0002dac1 / 0x00400000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: Extdef flags        : 0x00000000 / 0x00004000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: Extdefs             : 0x00000000 / 0x00004000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: F:/Dev/Current/CPP/AdFind/Release/AdFind.ilc: 0x00010000 / 0x08000000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: F:/Dev/Current/CPP/AdFind/Release/AdFind.ild: 0x00010000 / 0x08000000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: F:/Dev/Current/CPP/AdFind/Release/AdFind.ilf: 0x00016000 / 0x08000000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: F:/Dev/Current/CPP/AdFind/Release/AdFind.ils: 0x0004b000 / 0x03000000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: F:/Dev/Current/CPP/AdFind/Release/AdFind.tds: 0x00010000 / 0x06000000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: Import symbols      : 0x00000000 / 0x00100000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: OBJ symbols         : 0x00000000 / 0x00100000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: Public GSX          : 0x0000082c / 0x000c0000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: Publics             : 0x0000498c / 0x000c0000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: StringBlock         : 0x0000000b / 0x00400000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: Virdefs             : 0x0000082c / 0x00020000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets : warning : Warning: unknown heap name   : 0x08000000 / 0x08000000

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets(2089,3): error : Fatal: Error detected (IMP327)

e:\program files\codegear\rad studio\6.0\Bin\CodeGear.Cpp.Targets(2089,3): error : Fatal: Access violation.  Link terminated.

Rating 3.00 out of 5

One Response to “I am the bug magnet…”

  1. AlexB says:

    > 1. “-vi- -v-” should be functionally identical
    > with “-vi-”, they aren’t.
    > 2. The IDE uses “-vi- -v-” instead of “-vi-”

    BCB5 help:
    ——————-
    -vi- No inline calls
    -vi Inline calls

    -v Turn on source debugging
    (implicitly turns inline expansion off: -vi-)
    -v- Turn off source debugging

    Precedence rules:
    The last option typed overrides any earlier one.
    For both debugging and inline expansion on: -v -vi
    ——————-
    Unfortunately:
    1) this part of documentation was missed in new help;
    2) IDE generates bcc command line options in wrong order:
    “-vi -v” (-v overrides -vi).

[joeware – never stop exploring… :) is proudly powered by WordPress.]