[comp.lang.c] Bug list for Microsoft C

iverson@cory.Berkeley.EDU (Tim Iverson) (07/18/88)

I seem to recall that a bug list for the various versions of MSC (4.0 - 5.1)
flew by on the net.  Does anyone recall if there was such a beast and
where it might be obtained (hopefully via ftp).

If you know that there is no such list, could you let me know that, too?

If you know of a bug, could you tell us?  Please?

Since I read this group, please POST, don't email, your answers.  :-)


- Tim Iverson
  iverson@cory.Berkeley.EDU
  ucbvax!cory!iverson

aeusemrs@csuna.UUCP (Mike Stump) (07/19/88)

In article <4516@pasteur.Berkeley.Edu> iverson@cory.Berkeley.EDU.UUCP (Tim Iverson) writes:
}I seem to recall that a bug list for the various versions of MSC (4.0 - 5.1)
}flew by on the net.  Does anyone recall if there was such a beast and
}where it might be obtained (hopefully via ftp).

}If you know of a bug, could you tell us?  Please?

}Since I read this group, please POST, don't email, your answers.  :-)

Tim, I would normally email this directly to you, but mail mail program will
not let me; (It must have seen the above line) can you believe it?  Well,
for all of those people out there that think they have a 'C' compiler
(according to Doug) running on thier 80*8[86]:

int i=1, j=33;

main() {
    printf("%x\n", 1<<33);
    printf("%x\n", 1>>33);
    printf("%x\n", i<<j);
    printf("%x\n", i>>j);
}

What results do you get? (This might even be interesting on non 86 machines;
oh boy, I just checked a non 86, and it failed too.)

p.s. - Doug, (or Chris) (1<<0) == 1 && (n>0 ? ((1<<n) == ((1<<(n-1))<<1)) : 1)
		     && (n>0) ? ((1<<n)&1)==0 : 1
       right?
-- 
Mike Stump, Cal State Univ, Northridge Comp Sci Department
uucp: {sdcrdcf, hplabs, ttidca, psivax, csustan}!csun!csuna!aeusemrs

seanf@sco.COM (Sean Fagan) (07/19/88)

In article <4516@pasteur.Berkeley.Edu> iverson@cory.Berkeley.EDU.UUCP (Tim Iverson) writes:
>int i=1, j=33;
>
>main() {
>    printf("%x\n", 1<<33);
>    printf("%x\n", 1>>33);
>    printf("%x\n", i<<j);
>    printf("%x\n", i>>j);
>}
>What results do you get? (This might even be interesting on non 86 machines;
>oh boy, I just checked a non 86, and it failed too.)

Under Xenix '386, I get: 2, 0, 2, 0; using the '286 compiler, I get 0, 0, 2,
0.  So, anybody, what does ANSI say (in plain English)?  I tried reading the
draft to see what it should be, and I couldn't make head nor tail of it...
Somebody said, earlier, that both K&R and ANSI say the results are
implementation defined, but, from what I could stand of the draft, it didn't
seem to say that.

>Mike Stump, Cal State Univ, Northridge Comp Sci Department
>aeusemrs@csuna.csun.edu

----------------
Sean Eric Fagan
seanf@sco

bobmon@iuvax.cs.indiana.edu (RAMontante) (07/19/88)

seanf@sco.COM (Sean Fagan) writes:
+iverson@cory.Berkeley.EDU.UUCP (Tim Iverson) writes:
+>int i=1, j=33;
+>
+>main() {
+>    printf("%x\n", 1<<33);
+>    printf("%x\n", 1>>33);
+>    printf("%x\n", i<<j);
+>    printf("%x\n", i>>j);
+>}
+>What results do you get? (This might even be interesting on non 86 machines;
+>oh boy, I just checked a non 86, and it failed too.)
+
+Under Xenix '386, I get: 2, 0, 2, 0; using the '286 compiler, I get 0, 0, 2,
+0.  So, anybody, what does ANSI say (in plain English)?  I tried reading the
+draft to see what it should be, and I couldn't make head nor tail of it...
+Somebody said, earlier, that both K&R and ANSI say the results are
+implementation defined, but, from what I could stand of the draft, it didn't
+seem to say that.

And Turbo C v1.5 gave me
0
0
0
0

Something of a letdown, that.  So what ARE the right numbers, and what is the
right answer?
-- 
--	bob,mon				(bobmon@iuvax.cs.indiana.edu)
--	"In this position, the skier is flying in a complete stall..."

jnh@ece-csc.UUCP (Joseph Nathan Hall) (07/20/88)

In article <10807@iuvax.cs.indiana.edu> bobmon@iuvax.UUCP (RAMontante) writes:
 seanf@sco.COM (Sean Fagan) writes:
 +iverson@cory.Berkeley.EDU.UUCP (Tim Iverson) writes:
 +>int i=1, j=33;
 +>
 +>main() {
 +>    printf("%x\n", 1<<33);
 +>    printf("%x\n", 1>>33);
 +>    printf("%x\n", i<<j);
 +>    printf("%x\n", i>>j);
 +>}
 +>What results do you get? (This might even be interesting on non 86 machines;
 +>oh boy, I just checked a non 86, and it failed too.)
 +
 +Under Xenix '386, I get: 2, 0, 2, 0; using the '286 compiler, I get 0, 0, 2,
 +0.  So, anybody, what does ANSI say (in plain English)?  I tried reading the
 +draft to see what it should be, and I couldn't make head nor tail of it...
 +Somebody said, earlier, that both K&R and ANSI say the results are
 +implementation defined, but, from what I could stand of the draft, it didn't
 +seem to say that.
 
 And Turbo C v1.5 gave me
 0
 0
 0
 0
 
 Something of a letdown, that.  So what ARE the right numbers, and what is the
 right answer?

First of all, you're not using a good example.  See page 45 of K&R.  The
right-shift operation on SIGNED quanties is undefined.  In the case of
UNSIGNED quantities, the right-shift operation is supposed to fill vacated
bits with zeros.

Second, something is broken if 1 << 33 returns something other than 2^33 or
0, since for unsigned AND signed quantities, bits vacated during a left-shift
operation are supposed to be filled with zero.

My preferred result would be four zeros.

Unless, of course, I had default 48- or 64-bit integers.

-- 
v   v sssss|| joseph hall                      || 201-1D Hampton Lee Court
 v v s   s || jnh@ece-csc.ncsu.edu (Internet)  || Cary, NC  27511
  v   sss  || the opinions expressed herein are not necessarily those of my
-----------|| employer, north carolina state university . . . . . . . . . . . 

abcscnuk@csuna.UUCP (Naoto Kimura) (07/20/88)

Intrinsic functions "feature" (MSC 5.0):

Compile program with intrinsic functions turned on.   On a program
with statements such as:

	 outp( UGH, inp(PHOOEY) );

Compiler halts with an error message (something like
"compiler error #### call Microsoft").

                //-n-\\				Naoto Kimura
        _____---=======---_____			(csun!csuna!abcscnuk)
    ====____\   /.. ..\   /____====
  //         ---\__O__/---         \\	Enterprise... Surrender or we'll
  \_\                             /_/	send back your *&^$% tribbles !!

erc@pai.UUCP (Eric Johnson) (07/20/88)

[...]

In article <372@scolex>, seanf@sco.COM (Sean Fagan) writes:
> In article <4516@pasteur.Berkeley.Edu> iverson@cory.Berkeley.EDU.UUCP (Tim Iverson) writes:
> >int i=1, j=33;
> >
> >main() {
> >    printf("%x\n", 1<<33);
> >    printf("%x\n", 1>>33);
> >    printf("%x\n", i<<j);
> >    printf("%x\n", i>>j);
> >}
> >What results do you get? (This might even be interesting on non 86 machines;
> >oh boy, I just checked a non 86, and it failed too.)
> 
> >Mike Stump, Cal State Univ, Northridge Comp Sci Department
> >aeusemrs@csuna.csun.edu
> 
> ----------------
> Sean Eric Fagan
> seanf@sco

My results:
HP-UX [1]           MS-DOS [2]
  0                   0
  0                   0
  0                   2
  0                   0
[1] Hewlett-Packard 320 workstation, running HP-UX 5.5.
[2] Microsoft C 4.0, DOS 3.1.

What are the correct results? (I assume MSC is wrong, but I'm not sure
about the HP).

And anyway, back to the original purpose of the posting:
could someone email me, or post, a copy of the MSC bug list?
I'm interested to know what to expect from the compiler. I've already
come across what I think are bugs, especially in the malloc/free
routines (I seem to lose RAM as the program runs), but it would
be nice to know I'm not the only one hitting those problems.

Thanks,
-Eric


-- 
Eric F. Johnson          | Phone +1 612-894-0313             | Are we
Prime Automation,Inc     | UUCP: bungia!pai!erc              | having
12201 Wood Lake Drive    | UUCP: sun!tundra!pai!erc          | fun
Burnsville, MN 55337 USA | BIX:  erc                         | yet?

guy@gorodish.Sun.COM (Guy Harris) (07/21/88)

> +>main() {
> +>    printf("%x\n", 1<<33);
> +>    printf("%x\n", 1>>33);
> +>    printf("%x\n", i<<j);
> +>    printf("%x\n", i>>j);
> +>}
> +>What results do you get?
> +>oh boy, I just checked a non 86, and it failed too.)
> +
> +Under Xenix '386, I get: 2, 0, 2, 0; using the '286 compiler, I get 0, 0, 2,
> +0.  So, anybody, what does ANSI say (in plain English)?  I tried reading the
> +draft to see what it should be, and I couldn't make head nor tail of it...
> +Somebody said, earlier, that both K&R and ANSI say the results are
> +implementation defined, but, from what I could stand of the draft, it didn't
> +seem to say that.

Yes, both the current ANSI C draft and K&R say the result is undefined (not
even implementation-defined).  K&R:

	7.5 Shift operators

	...

	The result is undefined if the right operand is negative, or greater
	than or equal to the length of the object in bits.

ANSI C:

	3.3.7 Bitwise shift operators

	...If the value of the right operand is negative or is greater than or
	equal to the width in bits of the promoted left operand, the behavior
	is undefined.

> Something of a letdown, that.  So what ARE the right numbers, and what is the
> right answer?

There aren't any, and there isn't one.  Next question.

will.summers@p6.f18.n114.z1.fidonet.org (will summers) (07/22/88)

 > In article <4516@pasteur.Berkeley.Edu> iverson@cory.Berkeley.EDU.UUCP (Tim
 > Iverson) writes:
 > >int i=1, j=33;
 > >
 > >main() {
 > >    printf("%x\n", 1<<33);
 > >    printf("%x\n", 1>>33);
 > >    printf("%x\n", i<<j);
 > >    printf("%x\n", i>>j);
 > >}
 >
 > Under Xenix '386, I get: 2, 0, 2, 0;
 > 0.  So, anybody, what does ANSI say (in plain English)?
 
ANSI says as little as possible in plain English :8->
 
Actually (Jan '88 draft, pg 49) it says:
 
 "... If the value of the right operand is negative or is greater than or
  equal to the width in bits of the promoted left operand, the behavior is
  undefined."
 
So if int's on your implementation are less than 34 bits, a shift count of
33 don't pass ANSI muster.
 
Undefined behavior, under ANSI, means that the implementation is free to do 
just about anything, including non-deterministic behavior. Could even cause a 
"crash" and not be a "broken" compiler as far as ANSI is concerned.
 
Undefined behavior is a broader category than "implementation defined" 
behavior, which may vary from implementation to implementation, but must be 
deterministic (and documented) for each specific implementation.  The 
implication seems that "implementation defined" behavior precludes 
irrationalities like crashing, but that does not seem to me to be explicitly 
stated in the spec.
 
    \/\/ill
 
 
 
 


--  
St. Joseph's Hospital/Medical Center - Usenet <=> FidoNet Gateway
Uucp: ...ncar!noao!asuvax!stjhmc!18.6!will.summers
Internet: will.summers@p6.f18.n114.z1.fidonet.org

det@hawkmoon.MN.ORG (Derek E. Terveer) (07/30/88)

In article <1289@csuna.UUCP>, aeusemrs@csuna.UUCP (Mike Stump) writes:
> What results do you get? (This might even be interesting on non 86 machines;
> oh boy, I just checked a non 86, and it failed too.)

This is what i got on an 80386 running uPort V/386 3.0-L2.2:
$ cc -v
cc: command -System V/386 Release 3.0 7/2/87 (shared)
$ a.out
2
0
2
0
-- 
Derek Terveer		det@hawkmoon.MN.ORG
			w(612)681-6986
			h(612)688-0667