Skip to content

Do not assume that build architecture has byte/char==8 bits#5962

Merged
tautschnig merged 1 commit intodiffblue:developfrom
tautschnig:char_bit
May 6, 2021
Merged

Do not assume that build architecture has byte/char==8 bits#5962
tautschnig merged 1 commit intodiffblue:developfrom
tautschnig:char_bit

Conversation

@tautschnig
Copy link
Copy Markdown
Collaborator

The C/C++ standard does not guarantee this, and limits.h/climits has the
CHAR_BIT define set properly.

All changes in this commit only refer to the platform the tool is being
built for. The analysis target requires a separate set of changes where
the byte width must be taken from the configuration or annotations
within expressions.

This is a first part of #917, now factored into a PR of its own.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 20, 2021

Codecov Report

Merging #5962 (74978c0) into develop (1c32785) will increase coverage by 0.19%.
The diff coverage is 94.54%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #5962      +/-   ##
===========================================
+ Coverage    74.11%   74.30%   +0.19%     
===========================================
  Files         1444     1444              
  Lines       157389   157404      +15     
===========================================
+ Hits        116646   116957     +311     
+ Misses       40743    40447     -296     
Impacted Files Coverage Δ
src/goto-cc/ms_cl_cmdline.cpp 0.00% <0.00%> (ø)
src/util/config.cpp 55.42% <ø> (ø)
src/util/irep_hash.h 100.00% <ø> (ø)
src/ansi-c/literals/convert_character_literal.cpp 68.29% <50.00%> (+36.58%) ⬆️
src/util/mp_arith.cpp 50.00% <75.00%> (-0.65%) ⬇️
jbmc/src/janalyzer/janalyzer_parse_options.cpp 48.42% <100.00%> (+0.16%) ⬆️
jbmc/src/jbmc/jbmc_parse_options.cpp 72.44% <100.00%> (+0.05%) ⬆️
jbmc/src/jdiff/jdiff_parse_options.cpp 68.79% <100.00%> (+0.22%) ⬆️
src/cbmc/cbmc_parse_options.cpp 76.24% <100.00%> (+0.05%) ⬆️
src/goto-analyzer/goto_analyzer_parse_options.cpp 71.68% <100.00%> (+0.08%) ⬆️
... and 14 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a8cfa6f...74978c0. Read the comment docs.

Copy link
Copy Markdown
Collaborator

@martin-cs martin-cs left a comment

Choose a reason for hiding this comment

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

Glad to see you and the author of #5873 managed to sort things out ( #5873 (comment) )

@tautschnig tautschnig force-pushed the char_bit branch 2 times, most recently from 10a5c8e to 4f565cc Compare April 7, 2021 16:27
@kroening
Copy link
Copy Markdown
Collaborator

Note that the commit message isn't entirely true: The changes to ansi-c/library/gcc.c affect the analysis platform, not the build platform.

The C/C++ standard does not guarantee this, and limits.h/climits has the
CHAR_BIT define set properly.

All changes in this commit only refer to the platform the tool is being
built for. The analysis target requires a separate set of changes where
the byte width must be taken from the configuration or annotations
within expressions.
@tautschnig
Copy link
Copy Markdown
Collaborator Author

Note that the commit message isn't entirely true: The changes to ansi-c/library/gcc.c affect the analysis platform, not the build platform.

Oh, indeed, I've moved those changes to the commit in #917 instead.

Copy link
Copy Markdown
Contributor

@chrisr-diffblue chrisr-diffblue left a comment

Choose a reason for hiding this comment

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

Thanks for the cleanup - much better :-)

log.status() << "JANALYZER version " << CBMC_VERSION << " "
<< sizeof(void *) * 8 << "-bit " << config.this_architecture()
<< " " << config.this_operating_system() << messaget::eom;
<< sizeof(void *) * CHAR_BIT << "-bit "
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Out-of-scope for this PR, but give how this exact log.status pattern is duplicated several times, it does rather feel like a utility function could be useful :-)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for highlighting this. Now PR'ed in #6089.

@tautschnig tautschnig merged commit bcb3821 into diffblue:develop May 6, 2021
@tautschnig tautschnig deleted the char_bit branch May 6, 2021 20:30
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.

6 participants