Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re: perl #190

Closed
p5pRT opened this issue Jul 14, 1999 · 2 comments
Closed

Re: perl #190

p5pRT opened this issue Jul 14, 1999 · 2 comments

Comments

@p5pRT
Copy link
Collaborator

@p5pRT p5pRT commented Jul 14, 1999

Migrated from rt.perl.org#996 (status was 'resolved')

Searchable as RT996$

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Jul 14, 1999

From bill@ibmoto.com

Bill

William Downey bill@​ibmoto.com
Somerset Design Center (512) 424-8314
Motorola, Inc.

#!/usr/local/bin/perl5

  print("Set \$tmp = -6\n");
  $tmp = -6;
  print(" tmp = $tmp\n");
  printf("Hex​: %x, Decimal​: %d, Integer​: %i\n", $tmp, $tmp, $tmp);
  print("\n");
  print("Add 1 to \$tmp\n");
  $tmp += 1;
  print(" tmp = $tmp\n");
  printf("Hex​: %x, Decimal​: %d, Integer​: %i\n", $tmp, $tmp, $tmp);
  print(" tmp = $tmp\n");
  print("\n");
  print("Mult \$tmp by 1\n");
  $tmp = $tmp * 1;
  print(" tmp = $tmp\n");
  printf("Hex​: %x, Decimal​: %d, Integer​: %i\n", $tmp, $tmp, $tmp);
  print("\n");
  print("And 0x0000FFFF to \$tmp\n");
  $tmp = $tmp & 0x0000FFFF;
  print(" tmp = $tmp\n");
  printf("Hex​: %x, Decimal​: %d, Integer​: %i\n", $tmp, $tmp, $tmp);

Perl4 results​:

Set $tmp = -6
tmp = -6
Hex​: fffffffa, Decimal​: -6, Integer​: 758513664

Add 1 to $tmp
tmp = -5
Hex​: fffffffb, Decimal​: -5, Integer​: 758448128
tmp = -5

Mult $tmp by 1
tmp = -5
Hex​: fffffffb, Decimal​: -5, Integer​: 758448128

And 0x0000FFFF to $tmp
tmp = 65531
Hex​: fffb, Decimal​: 65531, Integer​: 909456691

Perl5 results​:

Set $tmp = -6
tmp = -6
Hex​: fffffffa, Decimal​: -6, Integer​: -6

Add 1 to $tmp
tmp = -5
Hex​: 0, Decimal​: 0, Integer​: 0
tmp = -5

Mult $tmp by 1
tmp = -5
Hex​: 0, Decimal​: 0, Integer​: 0

And 0x0000FFFF to $tmp
tmp = 0
Hex​: 0, Decimal​: 0, Integer​: 0

Bill,

Try out this perl script and see if you get the expected result. Then
try it again with the "$tmp += 0;" line commented out. I don't get
the answer that I expect. Am I missing something?

$tmp = -6;
$tmp += 0;
print(" tmp = $tmp\n");
$tmp = $tmp & 0x0000FFFF;
print(" tmp = $tmp\n");

David

William Downey bill@​ibmoto.com
Somerset Design Center (512) 424-8314
Motorola, Inc.

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Jul 14, 1999

From [Unknown Contact. See original ticket]

Created by bill@ibmoto.com

Perlbug team,
  I ran my below listed code in Perl4(Patch level 36), Perl5.004_04 &
Perl5.004_03. Perl4 had no problems. Perl5 (either rev) failed. I only
get the failure if the starting value is negative.

Bill

William Downey bill@​ibmoto.com
Somerset Design Center (512) 424-8314
Motorola, Inc.

#!/usr/local/bin/perl5

  print("Set \$tmp = -6\n");
  $tmp = -6;
  print(" tmp = $tmp\n");
  printf("Hex​: %x, Decimal​: %d, Integer​: %i\n", $tmp, $tmp, $tmp);
  print("\n");
  print("Add 1 to \$tmp\n");
  $tmp += 1;
  print(" tmp = $tmp\n");
  printf("Hex​: %x, Decimal​: %d, Integer​: %i\n", $tmp, $tmp, $tmp);
  print(" tmp = $tmp\n");
  print("\n");
  print("Mult \$tmp by 1\n");
  $tmp = $tmp * 1;
  print(" tmp = $tmp\n");
  printf("Hex​: %x, Decimal​: %d, Integer​: %i\n", $tmp, $tmp, $tmp);
  print("\n");
  print("And 0x0000FFFF to \$tmp\n");
  $tmp = $tmp & 0x0000FFFF;
  print(" tmp = $tmp\n");
  printf("Hex​: %x, Decimal​: %d, Integer​: %i\n", $tmp, $tmp, $tmp);

Perl4 results​:

Set $tmp = -6
tmp = -6
Hex​: fffffffa, Decimal​: -6, Integer​: 758513664

Add 1 to $tmp
tmp = -5
Hex​: fffffffb, Decimal​: -5, Integer​: 758448128
tmp = -5

Mult $tmp by 1
tmp = -5
Hex​: fffffffb, Decimal​: -5, Integer​: 758448128

And 0x0000FFFF to $tmp
tmp = 65531
Hex​: fffb, Decimal​: 65531, Integer​: 909456691

Perl5 results​:

Set $tmp = -6
tmp = -6
Hex​: fffffffa, Decimal​: -6, Integer​: -6

Add 1 to $tmp
tmp = -5
Hex​: 0, Decimal​: 0, Integer​: 0
tmp = -5

Mult $tmp by 1
tmp = -5
Hex​: 0, Decimal​: 0, Integer​: 0

And 0x0000FFFF to $tmp
tmp = 0
Hex​: 0, Decimal​: 0, Integer​: 0

Perl Info


Site configuration information for perl 5.00404:

Configured by keith at Thu Nov 13 09:28:10 CST 1997.

Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
  Platform:
    osname=aix, osvers=4.1.5.0, archname=aix
    uname='aix speedy 1 4 000012027500 '
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3=y useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-O', gccversion=
    cppflags='-qmaxmem=8192 -D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -I/usr/local/include'
    ccflags ='-qmaxmem=8192 -D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=1, d_casti32=define, d_castneg=undef
    intsize=4, alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='ld', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-ldbm -ldb -lld -lm -lc -lbsd -lPW
    libc=/lib/libc.a, so=a
    useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_aix.xs, dlext=so, d_dlsymun=undef, ccdlflags='-bE:perl.exp'
    cccdlflags=' ', lddlflags='-H512 -T512 -bhalt:4 -bM:SRE -bI:$(PERL_INC)/perl.exp -bE:$(BASEEXT).exp -b noentry -lc -L/usr/local/lib'

Locally applied patches:
	


@INC for perl 5.00404:
	/usr/local/lib/perl5/aix/5.00404
	/usr/local/lib/perl5
	/usr/local/lib/perl5/site_perl/aix
	/usr/local/lib/perl5/site_perl
	/usr/local/lib/perl5/aix
	.


Environment for perl 5.00404:
    HOME=/home/bill
    LANG=En_US
    LC__FASTMSG=true
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=./bin:/home/bill/bin:/usr/local/bin:/usr/contrib/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/afs/bin:/usr/dt/bin:/usr/bin/X11:/sbin:/nfs/ibmoto/tools/bin:/nfs/ibmoto/tools/gnu/bin:/home/bill/palm/bin:/afs/ibmoto/tools/bin
    PERL_BADLANG (unset)
    SHELL=/usr/local/bin/tcsh


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.