Recent

Author Topic: [solved] strange behavior with constant set  (Read 1501 times)

jamie

  • Hero Member
  • *****
  • Posts: 6591
Re: [solved] strange behavior with constant set
« Reply #15 on: September 06, 2024, 02:47:03 am »
Quote

There's a related problem where the shifting operator silently ignores an operand of larger than (I think) 31.

MarkMLl

That problem is based on the CPU behavior because only the first 5 bits of the register are used which gives you the full range for
a 32 bit object.
   
 I don't know how the compiler handles it but if a greater Than 31 is placed in the register then you'll get a MOD effect of course where only the remainder is going to be valid.

 Basically the CPU ignores the rest in the register.

 64 bit registers of course monitor more bits, should be 6 bits by my account, operated on a 2-bit OS.
 %)
Jamie
The only true wisdom is knowing you know nothing

MarkMLl

  • Hero Member
  • *****
  • Posts: 7725
Re: strange behavior with constant set
« Reply #16 on: September 06, 2024, 08:02:34 am »
Markml that might explain the cutting off adding things at 31 items but it doesn’t explain it ignoring the set of values over 100. They are perfectly valid. So there are really two issues, the truncating at 31 items and the ignoring a set of higher values.

So raise it as a bug.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Joanna

  • Hero Member
  • *****
  • Posts: 1105
Re: strange behavior with constant set
« Reply #17 on: September 06, 2024, 11:39:29 pm »
Markml that might explain the cutting off adding things at 31 items but it doesn’t explain it ignoring the set of values over 100. They are perfectly valid. So there are really two issues, the truncating at 31 items and the ignoring a set of higher values.

So raise it as a bug.

MarkMLl
That sounds like a great idea, unfortunately everytime I go to the bug tracker I get a blank page and can do nothing!!
No wait I take that back if I try to register an account it gives me a bunch of captchas. I don’t think an account would help much for a blank page anyway..
« Last Edit: September 06, 2024, 11:44:25 pm by Joanna »
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

MarkMLl

  • Hero Member
  • *****
  • Posts: 7725
Re: strange behavior with constant set
« Reply #18 on: September 07, 2024, 09:43:07 am »
That sounds like a great idea, unfortunately everytime I go to the bug tracker I get a blank page and can do nothing!!
No wait I take that back if I try to register an account it gives me a bunch of captchas. I don’t think an account would help much for a blank page anyway..

For $deity's sake Joanna! I'm a complete holdout as far as invasive technology goes, but even I make sure can use the bug tracker... and being able to report bugs when one finds them is pretty much a prerequisite if one wants to be a responsible member of the community.

Here's what I've got, and I assure you that it's much more tightly managed than most peoples'.

* Up-to-date Debian Linux with KDE desktop.

* Firefox as web browser (there's a small number of cases where I find using a different browser to be useful. This isn't one of them.

* The browser is started with these parameters edited into the appropriate desktop menu:

Code: [Select]
-ProfileManager -no-remote %u

* I have multiple separate profiles, generally active at the same time.

** By default, all Javascript, Java etc. is disabled. I use this as the first-level tool for all blogs etc. that I don't trust as well as for Google searches.

** I then have one with scripting etc. enabled but with everything set to strict security, with NoScript installed and set to block everything that isn't specifically enabled.

** I have others for social media etc. which I assume contains toxic links.

Gmail, the FPC/Lazarus forum, and the GitLabs bug tracker (which replaced Mantis) run on the second of those. All caching, scripting, plugins etc. are kept separate, so unless some nasty bit of Javascript picked up via Youtube managed to break out of Firefox's sandbox or break the underlying operating system's security it wouldn't be able to get at my banking activities etc.

The only downside that bites me occasionally is that if an arbitrary program tries to fire up a new browser instance it has problems if the default profile is already running. I've not investigated but that might be something to do with the -no-remote option: TBH I can't remember why I've got that.

So seriously Joanna: if you're to be taken as anything more than an irritant you need to get your act together. Refusing to report bugs is anti-social.

MarkMLl
« Last Edit: September 07, 2024, 09:45:10 am by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

BrunoK

  • Hero Member
  • *****
  • Posts: 589
  • Retired programmer
Re: [solved] strange behavior with constant set
« Reply #19 on: September 07, 2024, 12:33:05 pm »
Defined in rtl\objpas\sysutils\sysutilh.inc, ~line 43 as
Code: Pascal  [Select][+][-]
  1.    TIntegerSet = Set of 0..SizeOf(Integer)*8-1;
So, as per James, cannot set a bit <0 or >31.

MarkMLl

  • Hero Member
  • *****
  • Posts: 7725
Re: [solved] strange behavior with constant set
« Reply #20 on: September 07, 2024, 12:53:31 pm »
Defined in rtl\objpas\sysutils\sysutilh.inc, ~line 43 as
Code: Pascal  [Select][+][-]
  1.    TIntegerSet = Set of 0..SizeOf(Integer)*8-1;
So, as per James, cannot set a bit <0 or >31.

But the issue is that an initial declaration like [0..7,102..105] is getting truncated to 32 bits without warning: that shouldn't happen.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Thaddy

  • Hero Member
  • *****
  • Posts: 15747
  • Censorship about opinions does not belong here.
Re: [solved] strange behavior with constant set
« Reply #21 on: September 07, 2024, 01:31:48 pm »
I don't see the problem either way:
Code: Pascal  [Select][+][-]
  1. program maxset;
  2.  
  3. type
  4.   bigenum = (
  5.   S0,S1,S2,S3,S4,S5,S6,S7,S8,S9,S10,
  6.   S11,S12,S13,S14,S15,S16,S17,S18,S19,S20,
  7.   S21,S22,S23,S24,S25,S26,S27,S28,S29,S30,
  8.   S31,S32,S33,S34,S35,S36,S37,S38,S39,S40,
  9.   S41,S42,S43,S44,S45,S46,S47,S48,S49,S50,
  10.   S51,S52,S53,S54,S55,S56,S57,S58,S59,S60,
  11.   S61,S62,S63,S64,S65,S66,S67,S68,S69,S70,
  12.   S71,S72,S73,S74,S75,S76,S77,S78,S79,S80,
  13.   S81,S82,S83,S84,S85,S86,S87,S88,S89,S90,
  14.   S91,S92,S93,S94,S95,S96,S97,S98,S99,S100,
  15.   S101,S102,S103,S104,S105,S106,S107,S108,S109,S110,
  16.   S111,S112,S113,S114,S115,S116,S117,S118,S119,S120,
  17.   S121,S122,S123,S124,S125,S126,S127,S128,S129,S130,
  18.   S131,S132,S133,S134,S135,S136,S137,S138,S139,S140,
  19.   S141,S142,S143,S144,S145,S146,S147,S148,S149,S150,
  20.   S151,S152,S153,S154,S155,S156,S157,S158,S159,S160,
  21.   S161,S162,S163,S164,S165,S166,S167,S168,S169,S170,
  22.   S171,S172,S173,S174,S175,S176,S177,S178,S179,S180,
  23.   S181,S182,S183,S184,S185,S186,S187,S188,S189,S190,
  24.   S191,S192,S193,S194,S195,S196,S197,S198,S199,S200,
  25.   S201,S202,S203,S204,S205,S206,S207,S208,S209,S210,
  26.   S211,S212,S213,S214,S215,S216,S217,S218,S219,S220,
  27.   S221,S222,S223,S224,S225,S226,S227,S228,S229,S230,
  28.   S231,S232,S233,S234,S235,S236,S237,S238,S239,S240,
  29.   S241,S242,S243,S244,S245,S246,S247,S248,S249,S250,
  30.   S251,S252,S253,S254,S255);
  31.  
  32. TBigSet = bitpacked set of bigenum;
  33.  
  34. procedure acceptbigset(var s:TBigset);
  35. begin
  36.  include(s, S251);
  37.  include(s, S1);
  38. end;
  39.  
  40. var
  41.  s:TBigSet =[];
  42.  e:BigEnum;
  43. begin
  44.  acceptbigset(s);
  45.  for e in s do writeln(e);
  46. end.
« Last Edit: September 07, 2024, 03:48:06 pm by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

MarkMLl

  • Hero Member
  • *****
  • Posts: 7725
Re: [solved] strange behavior with constant set
« Reply #22 on: September 07, 2024, 02:14:29 pm »
I don't see the problem either way:

Go back and read the thread.

OP's trying to assign bits > 31 to a TIntegerSet, which is defined as https://www.freepascal.org/docs-html/rtl/sysutils/tintegerset.html (i.e. 32 elements for the browser-impaired), but is getting no compile-time warning or error. That's /wrong/.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Thaddy

  • Hero Member
  • *****
  • Posts: 15747
  • Censorship about opinions does not belong here.
Re: [solved] strange behavior with constant set
« Reply #23 on: September 07, 2024, 02:37:37 pm »
That is indeed wrong. I missed that, not because of my browser but because of shout case.
If I smell bad code it usually is bad code and that includes my own code.

MarkMLl

  • Hero Member
  • *****
  • Posts: 7725
Re: [solved] strange behavior with constant set
« Reply #24 on: September 07, 2024, 03:05:41 pm »
That is indeed wrong. I missed that, not because of my browser but because of shout case.

Don't worry, it's not easy to follow particularly since OP has refused to provide a compilable test case (and can't be relied on to follow links to documentation etc., hence my "browser-impaired" dig which definitely wasn't aimed at you).

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Joanna

  • Hero Member
  • *****
  • Posts: 1105
Re: [solved] strange behavior with constant set
« Reply #25 on: September 07, 2024, 04:39:59 pm »
Quote
So seriously Joanna: if you're to be taken as anything more than an irritant you need to get your act together. Refusing to report bugs is anti-social.
I found some bugs and reported them to everyone who reads my posts. If anyone is antisocial it’s the people who refuse to help me get them into bug tracker when it’s obvious I’m having technical difficulties and choose to berate me instead. That’s a fine way to reward someone for finding a bug. Maybe I should just pretend bugs don’t exist in the future, so I won’t get blamed for their existence.
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

Thaddy

  • Hero Member
  • *****
  • Posts: 15747
  • Censorship about opinions does not belong here.
Re: [solved] strange behavior with constant set
« Reply #26 on: September 07, 2024, 04:46:25 pm »
No, you should learn to write proper bug reports with proper full code, reproducable or not.
You could have written my example above, although out-of-context as Mark pointed out, it is full code.
If I smell bad code it usually is bad code and that includes my own code.

Joanna

  • Hero Member
  • *****
  • Posts: 1105
Re: [solved] strange behavior with constant set
« Reply #27 on: September 07, 2024, 05:04:50 pm »
@thaddy I’ve never seen include procedure before. What unit is it in? And what happened when you ran program?
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

MarkMLl

  • Hero Member
  • *****
  • Posts: 7725
Re: [solved] strange behavior with constant set
« Reply #28 on: September 07, 2024, 05:18:08 pm »
@thaddy I’ve never seen include procedure before. What unit is it in? And what happened when you ran program?

https://www.freepascal.org/docs-html/current/rtl/system/include.html

Joanna, get off your arse and use the bug report system. "I found some bugs and reported them to everyone who reads my posts." is utterly meaningless, and I've obviously been wasting my time trying to give you some pointers how to use a modern browser safely.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Joanna

  • Hero Member
  • *****
  • Posts: 1105
Re: [solved] strange behavior with constant set
« Reply #29 on: September 07, 2024, 06:38:57 pm »
Sorry, the gitlab site doesn’t work on my other computer either...
Could someone who has access to gitlab please post the bugs I’ve found?
This is so petty. I’ve done my part finding and sharing bugs. I give up!
Maybe the bug tracker should be in a place that is easier to use.
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

 

TinyPortal © 2005-2018