Skip to content

-frandom-seed: reduce value length#8

Merged
haampie merged 2 commits into
mainfrom
hs/fix/frandom-seed-length
May 14, 2026
Merged

-frandom-seed: reduce value length#8
haampie merged 2 commits into
mainfrom
hs/fix/frandom-seed-length

Conversation

@haampie
Copy link
Copy Markdown
Member

@haampie haampie commented May 14, 2026

The current default -frandom-seed="$*" can run into "Argument list too
long" errors (E2BIG). This happened in pytorch with 1300 object files on
the command line.

Fix that by filtering:

  1. flags
  2. object files
  3. static/shared libraries
  4. already parsed, separated paths from -I <path>, -L <path>, and others.

What remains is hopefully a short string that contains at a minimum all source files.

The current default `-frandom-seed="$*"` can run into "Argument list too
long" errors (E2BIG). This happened in pytorch with 1300 object files on
the command line.

Fix that by filtering out flags `-*`, object files and libraries.

Signed-off-by: Harmen Stoppels <harmenstoppels@gmail.com>
Signed-off-by: Harmen Stoppels <me@harmenstoppels.nl>
Copy link
Copy Markdown
Collaborator

@kwryankrattiger kwryankrattiger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

The early exit for the frandom seed string loop should be fine. The likely total size of the string, ordering of the args, and likely hood of hitting the early exit for most projects compiling with GCC should avoid too much wasted effort.

Tests look ok.

@haampie haampie merged commit e9fb6c4 into main May 14, 2026
1 check passed
@haampie haampie deleted the hs/fix/frandom-seed-length branch May 14, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants