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

pass_line_markers causes fatal error when reducing #195

Open
arichardson opened this issue Oct 29, 2019 · 6 comments
Open

pass_line_markers causes fatal error when reducing #195

arichardson opened this issue Oct 29, 2019 · 6 comments
Assignees
Labels

Comments

@arichardson
Copy link

After updating creduce I am no longer able to reduce clang crashes. Every time I try, creduce dies with the following stack trace:

Died at /usr/local/Cellar/creduce/2.10.0/share/creduce/perl/pass_line_markers.pm line 26.
 at /usr/local/Cellar/creduce/2.10.0/libexec/creduce line 35.
        main::__ANON__('Died at /usr/local/Cellar/creduce/2.10.0/share/creduce/perl/p...') called at /usr/local/Cellar/creduce/2.10.0/share/creduce/perl/pass_line_markers.pm line 26
        pass_line_markers::count_line_markers('usbdump-facd48-pp-smaller-reduce.c', 0) called at /usr/local/Cellar/creduce/2.10.0/share/creduce/perl/pass_line_markers.pm line 40
        pass_line_markers::new('usbdump-facd48-pp-smaller-reduce.c', 0) called at /usr/local/Cellar/creduce/2.10.0/libexec/creduce line 372
        main::call_new('pass_line_markers', 'usbdump-facd48-pp-smaller-reduce.c', 0) called at /usr/local/Cellar/creduce/2.10.0/libexec/creduce line 609
        main::delta_pass('HASH(0x7fc52886ad60)') called at /usr/local/Cellar/creduce/2.10.0/libexec/creduce line 1079
@arichardson
Copy link
Author

Locally I've worked around this by deleting the following line:

{ "name" => "pass_line_markers", "arg" => "0", "first_pass_pri" => 1, "C" => 1, },

Is there a way to work around this bug by passing command line flags? I often run creduce on a server where I can't build it from source or update packages.

@regehr
Copy link
Member

regehr commented Oct 29, 2019

I can add a command line option to remove a pass from the pass schedule, but I'd like to understand what leads to this assert being triggered, perhaps you can share a way for us to reproduce this problem? the line in question just opens the file being reduced, I don't see how this would fail.

@arichardson
Copy link
Author

It appears that this pass is attempting to open the file in the current working directory but I invoke creduce with the CWD set to a different directory.
In the example above my creduce wrapper uses ['time', '/usr/bin/creduce', '/tmp/tmpymnudx8l/reduce_script.sh', '/tmp/usbdump-facd48-pp-smaller-reduce.c', '--timing'] {'cwd': '/tmp/tmpymnudx8l'}

I just found a workaround: if I copy the input file to that directory before invoking creduce the pass will succeed.

It seems like the pass is opening the file before creduce has copied the current input to the working directory?

arichardson added a commit to arichardson/llvm-project that referenced this issue Oct 29, 2019
One of the passes expects the input file to existing in the cwd so copy it
there first before invoking creduce.
@regehr
Copy link
Member

regehr commented Oct 30, 2019

the rule for interestingness tests is that:

  • c-reduce will create a temporary directory somewhere and copy the file to it
  • c-reduce will set CWD to that directly and invoke your interestingness test
    it does not matter what the CWD is set to when you invoke C-Reduce

@arichardson
Copy link
Author

I think the following is happening:

pass_line_markers opens the file in sub new ($$) which is called by

my $state = call_new ($delta_method,$fileonly{$fn},$delta_arg);
.
All other passes seem to open the $cfilevariable inside transform.
It seems to me like c-reduce only copies the source file after calling new:
copy_files_here();

which is before calling transform:
(my $delta_res, $state) = call_transform ($delta_method,$variant,$delta_arg,$state);

Maybe pass_line_markers can be changed to open the file later?

arichardson added a commit to arichardson/creduce that referenced this issue Oct 30, 2019
@eeide eeide added the bug label Apr 24, 2020
@Absoler
Copy link

Absoler commented Nov 14, 2023

I found this too. It seems still not fixed. I have to put reduce target the same directory I invoke creduce, or use the option --skip-initial-passes

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

No branches or pull requests

4 participants