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

gcc11 O3 warnings #15123

Closed
tjhei opened this issue Apr 21, 2023 · 3 comments
Closed

gcc11 O3 warnings #15123

tjhei opened this issue Apr 21, 2023 · 3 comments
Milestone

Comments

@tjhei
Copy link
Member

tjhei commented Apr 21, 2023

I am getting the following 2 warnings with gcc 11.3 on Ubuntu 22.04:

/ssd/deal-git/source/grid/tria.cc: In static member function ‘static typename dealii::Triangulation<3, spacedim>::DistortedCellList dealii::internal::TriangulationImplementation::Implementation::execute_refinement_isotropic(dealii::Triangulation<3, spacedim>&, bool) [with int spacedim = 3]’:
/ssd/deal-git/source/grid/tria.cc:5712:43: warning: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’ writing 17179869180 bytes into a region of size 108 overflows the destination [-Wstringop-overflow=]
 5712 |                       vertex_indices[k++] = hex->vertex_index(i);
/ssd/deal-git/source/grid/tria.cc:5706:48: note: destination object ‘vertex_indices’ of size 108
 5706 |                   std::array<unsigned int, 27> vertex_indices = {};
      |                                                ^~~~~~~~~~~~~~
/ssd/deal-git/source/grid/tria.cc: In member function ‘void dealii::Triangulation<dim, spacedim>::execute_coarsening() [with int dim = 3; int spacedim = 3]’:
/ssd/deal-git/source/grid/tria.cc:14944:32: warning: iteration 12 invokes undefined behavior [-Waggressive-loop-optimizations]
14944 |               ++line_cell_count[line_indices[l]];
      |                 ~~~~~~~~~~~~~~~^
/ssd/deal-git/source/grid/tria.cc:14943:40: note: within this loop
14943 |             for (unsigned int l = 0; l < cell->n_lines(); ++l)
      |                                      ~~^~~~~~~~~~~~~~~~~

I played with the loops a little bit, but I am not able to get rid of the warnings. Any suggestions? Is the first one an unsigned int overflow?

@bangerth bangerth added this to the Release 9.5 milestone Apr 27, 2023
@bangerth
Copy link
Member

For reference, I have that too. I have to admit that I don't understand how the compiler comes up with this.

@bangerth
Copy link
Member

bangerth commented Jun 7, 2023

Is this still true? I thought we fixed that.

@kronbichler
Copy link
Member

Yes, we fixed this in #15220; that PR also gives an explanation on why this happened. I'm closing.

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

No branches or pull requests

3 participants