Skip to content

Fix compile errors related to free variables #101

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

Merged
merged 7 commits into from
Jan 21, 2021
Merged

Fix compile errors related to free variables #101

merged 7 commits into from
Jan 21, 2021

Conversation

kkjeer
Copy link
Contributor

@kkjeer kkjeer commented Sep 15, 2020

This PR fixes compile errors that occurred in the Olden and Ptrdist benchmarks due to the changes in checkedc-clang/#903. The checkedc-clang PR detects free variables in declared and inferred bounds and emits a compiler error if free variables are found.

This PR changes some declared bounds and reorders some code so that no free variables are involved in declared and inferred bounds. In particular:

  • The bounds of the global totalSCC array pointer. in vcg.h use channelNets rather than totalSCC in the declared bounds (totalSCC is allocated using channelNets).
  • The SCCofVCG method in vcg.c accepts an additional parameter for the length of the perSCC array pointer. Many functions in vcg.c reference global variables in parameter bounds. Continuing to clean up these global references is a future work item Remove uses of global variables in parameter bounds #100.
  • The GetPhrase method in anagram.c references the parameter pch rather than the global achPhrase in its declared bounds.
  • Some assignments and declarations are reordered to avoid free variables in declared and inferred bounds.

@kkjeer kkjeer requested review from dtarditi and mgrang September 15, 2020 21:35
Copy link
Contributor

@dtarditi dtarditi left a comment

Choose a reason for hiding this comment

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

Looks good. There are some white space changes that I think can be reverted.

@@ -40,8 +40,8 @@ AllocVCG(void)
storageVCG = storageRootVCG;
storageLimitVCG = (channelNets + 1) * (channelNets + 1);
SCC = malloc<ulong>((channelNets + 1) * sizeof(ulong));
perSCC = malloc<ulong>((channelNets + 1) * sizeof(ulong));
removeVCG = malloc<_Ptr<constraintVCGType>>((channelNets + 1) * (channelNets + 1) * sizeof(constraintVCGType *));
perSCC = malloc<ulong>((channelNets + 1) * sizeof(ulong));
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like an unneeded white space change.

@@ -293,7 +291,7 @@ SCCofVCG(_Array_ptr<nodeVCGType> VCG : count(channelNets + 1),
for (net = 1; net <= channelNets; net++) {
SCC[net] = VCG[net].netsBelowLabel;
if (SCC[net] > totalSCC) {
totalSCC = SCC[net];
totalSCC = SCC[net];
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like an unneeded white space change.

@kkjeer kkjeer merged commit dd1e886 into master Jan 21, 2021
@kkjeer kkjeer deleted the free-variables branch January 21, 2021 18:31
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