Bob entered a grocery store without a shirt. Charles entered a restaurant.
Are there any laws that make either of these either absolutely or conditionally a problem?
There's no law specifying that shirts must be worn by people visiting shops or restaurants.
As the owner or tenant of the property the business can set the rules for who is allowed entry and service, provided it does not discriminate based on a 'protected characteristic' in the Equality Act.
The business can set a 'dress code' and refuse entry to people who are not dressed to code.
If a rule says "no topless people" that's OK. If a rule says "men must not be topless" then on the face of it that's unlawful discrimination. If a rule requires smart footwear that's OK. If a rule says "women must wear high heels" then on the face of it that's unlawful discrimination.
Generally the business can refuse to serve a person and require the person to leave the premises. If the person refuses to leave then they commit the civil tort of trespass. If the person then obstructs the lawful activity of the business or damages its property then they commit the criminal offence of aggravated trespass.
In the U.S. there is frequent signage on store and restaurant fronts that amounts to a "No shirt, no shoes, no service" message. This would likely fall under a pre-emptive "Trespass" warning as the store owner can refuse to allow a sale transaction to go through and ask the offender to leave if they do not comply. At this point, if the offender refuses to comply and leave, they could be charged with trespassing.
This has been in the UK news (WalesOnline, which is where I happened to read it) recently - in some areas of Spain there are laws, and not just about inside certain establishments:
In hotspots such as Barcelona and Majorca, topless men and women wearing bikinis face fines of up to €300 (£253) if they’re spotted walking around away from the beach. This can also include adjacent streets - so keep your shirts and cover-ups on until you hit the sand.
Or in the words of the UK Foreign Office
In some parts of Spain it’s against the law to be in the street wearing only a bikini or swimming shorts. Being bare-chested is also illegal in some areas in Spain. You may be fined if you’re caught wearing swimwear on the seafront promenade or adjacent streets.