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

Unable to create Fedora releases due to compilation error #3313

Closed
3 tasks
SeanTAllen opened this issue Sep 29, 2019 · 10 comments · Fixed by #3345
Closed
3 tasks

Unable to create Fedora releases due to compilation error #3313

SeanTAllen opened this issue Sep 29, 2019 · 10 comments · Fixed by #3345
Labels
help wanted Extra attention is needed

Comments

@SeanTAllen
Copy link
Member

SeanTAllen commented Sep 29, 2019

Fedora COPR builds changed the warnings they have on or otherwise changed the gcc version and ponyc no longer compiles. We need to fix this to get COPR builds working again.

See: https://copr-be.cloud.fedoraproject.org/results/ponylang/ponylang/fedora-29-x86_64/01042125-ponyc/build.log.

What we need to do:

  • investigate gcc version and flag used
  • setup/modify existing ci to match (not sure which is most applicable)
  • fix the issue

the 2nd 2 steps should be part of the same PR.

@SeanTAllen SeanTAllen pinned this issue Sep 29, 2019
@SeanTAllen
Copy link
Member Author

I think gcc 8.1 along with the -Werror=stringop-truncation flag should be enough to trigger this.

@SeanTAllen
Copy link
Member Author

It's unclear to me whether this is a real bug or not (the compiler thinks it is). I assume from a quick glance that it is, but we'd need to verify that.

@SeanTAllen
Copy link
Member Author

@jemc i'm not familiar with what is going on with the AST. Is this an actual error?

@jemc
Copy link
Member

jemc commented Oct 7, 2019

I get a 404 error when I click the link to see the build log. Do you have a copy of the error location and message?

@SeanTAllen
Copy link
Member Author

Ugh. Apparently the build log gets deleted after a week. It's gone.

Building with gcc 8.1 should do the trick. There's a warning about strncpy at 3 locations in verify.c.

The warning to use to see it is: "-Werror=stringop-truncation"

@stronny
Copy link

stronny commented Oct 26, 2019

I have this error on gcc (Debian 8.3.0-6) 8.3.0 i686:

src/libponyc/pass/refer.c: In function ‘generate_multi_dot_name’:
src/libponyc/pass/refer.c:154:3: error: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
   strncpy(buf + offset, name, slen);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/libponyc/pass/refer.c:153:17: note: length computed here
   size_t slen = strlen(name);
                 ^~~~~~~~~~~~
src/libponyc/pass/refer.c:165:5: error: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
     strncpy(buf + offset, name, slen);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/libponyc/pass/refer.c:164:12: note: length computed here
     slen = strlen(name);
            ^~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:925: build/release/obj-native/libponyc/pass/refer.o] Error 1

@SeanTAllen
Copy link
Member Author

An option to fix for now would be:

-Wno-stringop-truncation on Makefile line 134.

It doesn't verify if the warning is real or not (this need to look at that, but it should in theory, put gcc 8+ compilation on the same footing as all the others in that it will build.

@SeanTAllen
Copy link
Member Author

N.B. its quite possible that some of these are false positives.

@SeanTAllen
Copy link
Member Author

Yeah, these look like false positives.

SeanTAllen added a commit that referenced this issue Oct 26, 2019
Starting with GCC 8, they added a new warning `stringops-truncation`. It
is well intentioned but, seems prone to a lot of false positives.

It found several false positives in the Pony codebase and because we treat
all warnings as errors, you can't build ponyc with GCC 8+.

This commit turns off the new warning and returns us to a state of bliss.

Fixes #3313
SeanTAllen added a commit that referenced this issue Oct 26, 2019
Starting with GCC 8, they added a new warning `stringops-truncation`. It
is well intentioned but, seems prone to a lot of false positives.

It found several false positives in the Pony codebase and because we treat
all warnings as errors, you can't build ponyc with GCC 8+.

This commit turns off the new warning and returns us to a state of bliss.

Fixes #3313
@SeanTAllen
Copy link
Member Author

Using Ubuntu Xenial and Gcc 8.3, I am unable to reproduce this. Very odd.

SeanTAllen added a commit that referenced this issue Oct 26, 2019
Starting with GCC 8, they added a new warning `stringops-truncation`. It
is well intentioned but, seems prone to a lot of false positives.

It found several false positives in the Pony codebase and because we treat
all warnings as errors, you can't build ponyc with GCC 8+.

This commit switches from using strncpy to memcpy. They are in the end, the
same operation except a difference in return type. However, with the new
gcc option, memcpy will not complain about not copying the null terminator.

Fixes #3313
SeanTAllen added a commit that referenced this issue Oct 27, 2019
Starting with GCC 8, they added a new warning `stringops-truncation`. It
is well intentioned but, seems prone to a lot of false positives.

It found several false positives in the Pony codebase and because we treat
all warnings as errors, you can't build ponyc with GCC 8+.

This commit switches from using strncpy to memcpy. They are in the end, the
same operation except a difference in return type. However, with the new
gcc option, memcpy will not complain about not copying the null terminator.

Fixes #3313
@SeanTAllen SeanTAllen unpinned this issue Oct 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants