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

[root6] Fix call to memset in TpcAvgCurrent.C #487

Merged
merged 1 commit into from
Jan 30, 2023

Conversation

plexoos
Copy link
Member

@plexoos plexoos commented Jan 30, 2023

StWarning: StDbSql::QueryDb(table,time) line=439 TpcAvgCurrent  has No data for query
LoadTable: .L /star-sw/StarDb/Calibrations/tpc/TpcAvgCurrent.C
In file included from input_line_983:1:
/star-sw/StarDb/Calibrations/tpc/TpcAvgCurrent.C:6:3: error: no matching function for call to 'memset'
  memset(row, 0, sizeof(TpcAvgCurrent_st));
  ^~~~~~
/usr/include/string.h:62:14: note: candidate function not viable: no known conversion from 'TpcAvgCurrent_st' to 'void *' for 1st argument; take the address of the argument with &
extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
             ^
root4star: .sl79_gcc485/OBJ/StRoot/St_db_Maker/St_db_Maker.cxx:932: virtual TDataSet* St_db_Maker::LoadTable(TDataSet*): Assertion `!ee' failed.
Aborted

```
StWarning: StDbSql::QueryDb(table,time) line=439 TpcAvgCurrent  has No data for query
LoadTable: .L /star-sw/StarDb/Calibrations/tpc/TpcAvgCurrent.C
In file included from input_line_983:1:
/star-sw/StarDb/Calibrations/tpc/TpcAvgCurrent.C:6:3: error: no matching function for call to 'memset'
  memset(row, 0, sizeof(TpcAvgCurrent_st));
  ^~~~~~
/usr/include/string.h:62:14: note: candidate function not viable: no known conversion from 'TpcAvgCurrent_st' to 'void *' for 1st argument; take the address of the argument with &
extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
             ^
root4star: .sl79_gcc485/OBJ/StRoot/St_db_Maker/St_db_Maker.cxx:932: virtual TDataSet* St_db_Maker::LoadTable(TDataSet*): Assertion `!ee' failed.
Aborted
```
@plexoos plexoos requested a review from iraklic as a code owner January 30, 2023 00:56
@plexoos plexoos added the ROOT6 Issues and changes related to transition from ROOT5 to ROOT6 label Jan 30, 2023
@plexoos plexoos merged commit a4a7dba into star-bnl:main Jan 30, 2023
@plexoos plexoos deleted the pr/fix_memset branch January 30, 2023 16:25
@genevb
Copy link
Contributor

genevb commented Jan 30, 2023

I can't even view this directory on github because of all the old files that came and went:
https://github.com/star-bnl/star-sw/tree/main/StarDb/Calibrations/tpc
message from github (not my browser): "This page is taking too long to load."
:-(

@klendathu2k
Copy link
Contributor

klendathu2k commented Jan 30, 2023 via email

@iraklic
Copy link
Member

iraklic commented Jan 30, 2023

I have a question about this, how did it ever work if it needed &row and had row for many years till now?

@genevb
Copy link
Contributor

genevb commented Jan 30, 2023 via email

@klendathu2k
Copy link
Contributor

klendathu2k commented Jan 30, 2023 via email

@plexoos
Copy link
Member Author

plexoos commented Jan 30, 2023

The old code worked because in reality a pointer was passed to memset regardless of what the source code said. This is the result of CINT not following the C++ standard but with ROOT6 cling we can detect such leeways and fix them.

@iraklic you can still approve this PR if you feel like it. I was not sure it was worth waiting

@iraklic
Copy link
Member

iraklic commented Jan 30, 2023

Thank you. That is kind of what I suspected, but I was thinking since we are compiling the code it would pass through the compilator C++ rules and not CINT, but I guess there are details that are not as clear to me in this regard.

@plexoos
Copy link
Member Author

plexoos commented Jan 30, 2023

This particular file (actually all .C files in StarDB/Calibrations/) is "interpreted" by CINT/Cling

@iraklic
Copy link
Member

iraklic commented Jan 30, 2023

This particular file (actually all .C files in StarDB/Calibrations/) is "interpreted" by CINT/Cling

Oh, right, that is the answer that puts things in place. Yes I forgot for a moment about our way with some cint files. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ROOT6 Issues and changes related to transition from ROOT5 to ROOT6
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants