Skip to content

goto-instrument: diverse problems with the signal.h API #973

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

Closed
stahlbauer opened this issue May 26, 2017 · 2 comments
Closed

goto-instrument: diverse problems with the signal.h API #973

stahlbauer opened this issue May 26, 2017 · 2 comments

Comments

@stahlbauer
Copy link
Contributor

Producing code from goto-files that reference signal.h causes several problems.

Example program:

#include<signal.h>
#include<stdlib.h>

void sig_block(int sig)                                               
{                                                                               
    sigset_t ss;                                                                
    sigemptyset(&ss);                                                           
    sigaddset(&ss, sig);                                                        
    sigprocmask(SIG_BLOCK, &ss, NULL);                                          
}  

int main() {
    sig_block(0);
    return 0;
}

Resulting C file (produced with goto-instrument):

#include <signal.h>

#ifndef NULL
#define NULL ((void*)0)
#endif

// sig_block
// file example_typedef_sigset.c line 4
void sig_block(signed int sig);

signed int main()
{
  sig_block(0);
  return 0;
}

void sig_block(signed int sig)
{
  struct anonymous ss;
  sigemptyset(&ss);
  sigaddset(&ss, sig);
  sigprocmask(0, &ss, ((sigset_t *)NULL));
}

Especially the translation of sigset_t ss; to struct anonymous ss; seems to be critical (the struct anonymous is declared/defined nowhere).

@stahlbauer
Copy link
Contributor Author

@tautschnig: FYI

@tautschnig
Copy link
Collaborator

Fix included in #858.

tautschnig pushed a commit to tautschnig/cbmc that referenced this issue Jun 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants