error C1001: INTERNAL COMPILER ERROR

Hi,

I get a very strange build error when I build my driver with w2k3 SP1 DDK (build 3790.1830). The driver build fails with a compile error “C1001: INTERNAL COMPILER ERROR”. This only happens when I build the driver for Windows 2000. Does anyone know how to fix the build issue?

Thanks,
JT

Find the piece of code which causes it and rewrite it different way. It can be the bug in your code (the last time I saw it was when I mistakenly did something wrong with C++ references) or the compiler problem.

BTW, I’d start with full rebuild, compiler can be confused by some residues from previous build.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of xxxxx@emc.com[SMTP:xxxxx@emc.com]
Reply To: Windows System Software Devs Interest List
Sent: Thursday, October 05, 2006 6:03 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] error C1001: INTERNAL COMPILER ERROR

Hi,

I get a very strange build error when I build my driver with w2k3 SP1 DDK (build 3790.1830). The driver build fails with a compile error “C1001: INTERNAL COMPILER ERROR”. This only happens when I build the driver for Windows 2000. Does anyone know how to fix the build issue?

Thanks,
JT


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

JT:

Do you have any idea of where it is failing? If so, some code would
help. If not, best of luck. I have seen errors of this type (but not
with the DDK your using) several times, all of which boiled down to
issues with templates not being supported correctly (at least as far
they shouldn’t generate internal errors, but generally incorrectly
overall). If you can give me some code, I might be able to help.

MM

>> xxxxx@emc.com 2006-10-05 12:03:30 >>>
Hi,

I get a very strange build error when I build my driver with w2k3 SP1
DDK (build 3790.1830). The driver build fails with a compile error
“C1001: INTERNAL COMPILER ERROR”. This only happens when I build the
driver for Windows 2000. Does anyone know how to fix the build issue?

Thanks,
JT


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

I managed to fix the build issue by re-organizing the code but I still don’t understand why the compiler for w2k in w2k3 sp1 DDK doesn’t like the code. The “bad” code looks like

Func() /* bad one */
{
BOOL var1;
UserStruct_t var2;


retry:
if(var1)
{
/*initialize variables */
}
else
{
/* initialize variables */
}

if ()
{
/* do the work 1 */
}
else
{
if(condition1)
{
/* do work 2 */
}
else
{
if(condition2)
{
goto retry;
}
}
}
}

If I move the label retry down to the second if() statement, the compiler error goes away. The good code looks like:

Func() /* good one */
{
BOOL var1;
UserStruct_t var2;

if(var1)
{
/*initialize variables */
}
else
{
/* initialize variables */
}

retry:

if ()
{
/* do the work 1 */
}
else
{
if(condition1)
{
/* do work 2 */
}
else
{
if(condition2)
{
goto retry;
}
}
}
}

xxxxx@emc.com wrote:

I managed to fix the build issue by re-organizing the code but I still don’t understand why the compiler for w2k in w2k3 sp1 DDK doesn’t like the code.

There’s nothing to understand. This is a compiler bug. It’s a screw-up.

You might consider using a “do” or “while” loop instead of a goto, not
so much because of philosophical objections to “goto”, but rather
because it might allow you to express the same concept in a way that the
compiler will accept.

bRetry = FALSE;
do {

if( condition2 ) {
bRetry = TRUE;
continue;
}

} while( bRetry );


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

I have absolutely no idea. Is there any way you could post the actual
code itself for the entire function? I’m curious. If so, what is the
exact verison of the compiler you are using (what it displays when you
type “CL”), is this being compiled as C or C++, and are you using any
flags to enable/disable ANSI compliance (-Za/-Ze), or C++ conformance
(-Zc:forScope/-Zc:wchar_t) or anything else unusual.

mm

>> xxxxx@emc.com 2006-10-06 12:05 >>>
I managed to fix the build issue by re-organizing the code but I still
don’t understand why the compiler for w2k in w2k3 sp1 DDK doesn’t like
the code. The “bad” code looks like

Func() /* bad one */
{
BOOL var1;
UserStruct_t var2;


retry:
if(var1)
{
/*initialize variables */
}
else
{
/* initialize variables */
}

if ()
{
/* do the work 1 */
}
else
{
if(condition1)
{
/* do work 2 */
}
else
{
if(condition2)
{
goto retry;
}
}
}
}

If I move the label retry down to the second if() statement, the
compiler error goes away. The good code looks like:

Func() /* good one */
{
BOOL var1;
UserStruct_t var2;

if(var1)
{
/*initialize variables */
}
else
{
/* initialize variables */
}

retry:

if ()
{
/* do the work 1 */
}
else
{
if(condition1)
{
/* do work 2 */
}
else
{
if(condition2)
{
goto retry;
}
}
}
}


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

It can be caused by some different define or typedef in the DDK headers. For example, BOOL could be 1 byte for w2k and 4 bytes for w2k3 (I dont’ say it really is!). Try to compare generated code in both cases for “fixed” code.

On the other hand, I don’t wonder compiler barfs seeing this code. Me too. This is clear example how “goto” shouldn’t be used (simple rule: goto back is never OK whereas goto forward can be).

It’d be interesting if you post the real code. I guess there isn’t “if ()” statement.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of xxxxx@emc.com[SMTP:xxxxx@emc.com]
Reply To: Windows System Software Devs Interest List
Sent: Friday, October 06, 2006 6:05 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] error C1001: INTERNAL COMPILER ERROR

I managed to fix the build issue by re-organizing the code but I still don’t understand why the compiler for w2k in w2k3 sp1 DDK doesn’t like the code. The “bad” code looks like

Func() /* bad one */
{
BOOL var1;
UserStruct_t var2;


retry:
if(var1)
{
/*initialize variables */
}
else
{
/* initialize variables */
}

if ()
{
/* do the work 1 */
}
else
{
if(condition1)
{
/* do work 2 */
}
else
{
if(condition2)
{
goto retry;
}
}
}
}

If I move the label retry down to the second if() statement, the compiler error goes away. The good code looks like:

Func() /* good one */
{
BOOL var1;
UserStruct_t var2;

if(var1)
{
/*initialize variables */
}
else
{
/* initialize variables */
}

retry:

if ()
{
/* do the work 1 */
}
else
{
if(condition1)
{
/* do work 2 */
}
else
{
if(condition2)
{
goto retry;
}
}
}
}


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Next possibility: different compiler switches can be used for w2k type build. Especially optimization can influence it. Compare build*.log files. Also, have you tried free and checked build for w2k?

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Michal Vodicka[SMTP:xxxxx@upek.com]
Reply To: Windows System Software Devs Interest List
Sent: Friday, October 06, 2006 8:39 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] error C1001: INTERNAL COMPILER ERROR

It can be caused by some different define or typedef in the DDK headers. For example, BOOL could be 1 byte for w2k and 4 bytes for w2k3 (I dont’ say it really is!). Try to compare generated code in both cases for “fixed” code.

On the other hand, I don’t wonder compiler barfs seeing this code. Me too. This is clear example how “goto” shouldn’t be used (simple rule: goto back is never OK whereas goto forward can be).

It’d be interesting if you post the real code. I guess there isn’t “if ()” statement.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]

> ----------
> From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of xxxxx@emc.com[SMTP:xxxxx@emc.com]
> Reply To: Windows System Software Devs Interest List
> Sent: Friday, October 06, 2006 6:05 PM
> To: Windows System Software Devs Interest List
> Subject: RE:[ntdev] error C1001: INTERNAL COMPILER ERROR
>
> I managed to fix the build issue by re-organizing the code but I still don’t understand why the compiler for w2k in w2k3 sp1 DDK doesn’t like the code. The “bad” code looks like
>
> Func() /* bad one */
> {
> BOOL var1;
> UserStruct_t var2;
>
> …
> retry:
> if(var1)
> {
> /*initialize variables */
> }
> else
> {
> /* initialize variables */
> }
>
> if ()
> {
> /* do the work 1 */
> }
> else
> {
> if(condition1)
> {
> /* do work 2 */
> }
> else
> {
> if(condition2)
> {
> goto retry;
> }
> }
> }
> }
>
> If I move the label retry down to the second if() statement, the compiler error goes away. The good code looks like:
>
> Func() /* good one */
> {
> BOOL var1;
> UserStruct_t var2;
>
> …
>
> if(var1)
> {
> /*initialize variables */
> }
> else
> {
> /* initialize variables */
> }
>
> retry:
>
> if ()
> {
> /* do the work 1 */
> }
> else
> {
> if(condition1)
> {
> /* do work 2 */
> }
> else
> {
> if(condition2)
> {
> goto retry;
> }
> }
> }
> }
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer