Skip to content

Fix compilation error (-Wstringop-overflow) #68

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 1 commit into from
Sep 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/process_moc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ char* data_as_char(Smoc* moc, size_t offset = 0)
static
char* detoasted_offset(Smoc* moc, size_t offset = 0)
{
return offset + reinterpret_cast<char*>(&(moc->version));
return offset + reinterpret_cast<char*>(moc) + offsetof(Smoc, version);
}

template<class X, class Y>
Expand Down Expand Up @@ -240,7 +240,7 @@ struct moc_tree_layout
{
rest_level = entries - rest_entries;
this_page = page_rest;
}
}
else // there is only a single page fragment at this level
{
rest_level = 0;
Expand Down Expand Up @@ -526,13 +526,13 @@ get_moc_size(void* moc_in_context, pgs_error_handler error_out)
}
if (check == b_tree_inf)
throw std::logic_error("infinite loop for MOC B-tree depth");

// layout: start with the section of the ends of each B+-tree level
size_t depth = m.layout.size() - 1;
moc_size += depth * MOC_INDEX_ALIGN;
// layout: B+-tree layout, starting at root node
for (unsigned k = depth; k >= 1; --k)
{
{
m.layout[k].layout_level(moc_size, MOC_TREE_ENTRY_SIZE);
}
if (m.layout[depth].level_end > static_cast<size_t>(
Expand Down Expand Up @@ -568,7 +568,7 @@ create_moc_release_context(void* moc_in_context, Smoc* moc,

hpint64 area = 0;

// this guards against
// this guards against
char* moc_data = detoasted_offset(moc, 0);

// All levels will be filled out from end to beginning such that
Expand Down Expand Up @@ -726,7 +726,7 @@ order_break(output_map & outputs, const moc_interval & x, int max_order)
void
ascii_out(std::string & m_s, char* s, Smoc* moc, int32 begin, int32 end,
int32 entry_size)
{
{
// moc output fiddling:
int order = moc->order;
m_s.reserve(end); // rough guess
Expand Down Expand Up @@ -817,7 +817,7 @@ create_moc_out_context(Smoc* moc, int32 end, pgs_error_handler error_out)
return ret;
}

void
void
release_moc_out_context(moc_out_data out_context, pgs_error_handler error_out)
{
release_context<moc_output>(out_context.context, error_out);
Expand Down